Msg 229, Level 14, State 5, Procedure SP_send_dbmail, Line 1, EXECUTE Permission denied on Object ‘sp_send_dbmail’, Database ‘MSDB ‘, Schema’ dbO ‘.
This is because the current SQL Server login account (login) does not have permission to send database mail in the MSDB database, so you need to join the MSDB database user and give permission by joining the SP_addrolemEMBER role.
Assume that the SQL Server login account name is “DBA”
use msdb
The go
create user dba for login dba
go
Exec dbo.sp_addrolemember @rolename = ‘DatabaseMailUserRole’,
@ membername = ‘dbas’
go
At this point, if you send the database mail again, you may still have an error:
Msg 14607, Level 16, State 1, Procedure sp_send_dbmail, Line 119
profile name is not valid
Although the database user “DBA” already has permission to send messages in MSDB, this is not enough; he also needs permission to use profile: “dba_profile”.
use msdb
go
Exec sysmail_add_principalprofile_sp@principal_name = ‘DBA’
, @ profile_name = ‘dba_profile’
@ is_default = 1
This allows you to call Database Mail to send messages using your new account.
Read More:
- How to solve the Mapi error of outbook that can’t send mail directly
- SQL Msg 18054, Level 16, State 1
- [Solved] Springboot Project Error: Mail server connection failed;
- windows live mail error message
- How to deal with the error reported by live mail
- Java uses Netease mailbox 163 to send an error message
- Sendmail config error: mail loops back to me (MX problem?) solution
- Use XMLHttpRequest of JavaScript to send data to the background
- Error: no mail configuration found…
- Elasticsearch cluster cannot be started. The following prompt fails to send join request to master appears
- Python TCP socket programming: send returns broken pipe error?
- VirtualBox problem solving set -[drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message
- error: Some data has already been output, can’t send PDF file
- Under Linux, git cannot be used, prompt sign_and_send_pubkey: signing failed: agent refused operation
- Solution to SQL Server Error: 4064
- The reason why HashMap multithreads send out life and death loops
- Solution to the problem that SQL database query result field contains new line character, which leads to copy to excel dislocation
- request:fail url not in domain list or Cannot send network request to localhost
- Reporting Services Catalog Database File Existence” error during installing SQL Server 2008 R2