Sql-server – What permissions does the service account need to use database mail

database-mailpermissionssql serversql-server-2012

I have an SQL Server 2012 instance running under a managed service account. I've configured database mail with one account and am trying to send a test email, but I'm getting some errors in the server's event logs:

Database Engine Instance=MYINSTANCE;Mail PID=2132;Error Message:The update to the database failed. Reason: The EXECUTE permission was denied on the object 'sysmail_logmailevent_sp', database 'msdb', schema 'dbo'.

Database Engine Instance=MYINSTANCE;Mail PID=2212;
Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: The read on the database failed. Reason: The EXECUTE permission was denied on the object 'sp_readrequest', database 'msdb', schema 'dbo'.
Data: System.Collections.ListDictionaryInternal
TargetSite: Microsoft.SqlServer.Management.SqlIMail.Server.Objects.QueueItem GetQueueItemFromCommand(System.Data.SqlClient.SqlCommand)
HelpLink: NULL
Source: DatabaseMailEngine

If I make the account running the SQL Server process a sysadmin, this error goes away, and mails send successfully. However, all the research I've done suggests that giving this account the DatabaseMailUserRole role in the msdb database should be sufficient. I've done this and still receive the same errors.

I took a look in the BOL but couldn't find anything.

Best Answer

SQL Server Agent service account requires sysadmin permissions on the instance.

Microsoft KB