Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I setup database mail on a SQL Server 2005 instance and kept getting this log message whenever an email was tried:

Message
1) Exception Information

Exception Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Data: System.Collections.ListDictionaryInternal
TargetSite: Microsoft.SqlServer.Management.SqlIMail.Server.Objects.AccountGetAccount(Int32)
HelpLink: NULL
Source: DatabaseMailEngine

After checking to make sure my setup was correct, I tried adding the service account user to the sysadmin group, which resolved the problem.

But I'd like to know if that's necessary, or if the particular permissions issue was simply blanketed by the sysadmin role. Is there some more granular permission that I should be using?

share|improve this question

1 Answer 1

Yes, there is something less drastic than sysadmin!

To use database mail the user must be a user in the msdb database and a member of the DatabaseMailUserRole database role within msdb.

USE msdb
CREATE USER MailUser FOR LOGIN MailUser
GO
EXEC sp_addrolemember @rolename='DatabaseMailUserRole', @membername='MailUser'
GO
share|improve this answer
    
Thanks. That was already done, otherwise the mail wouldn't even get queued. The error message in my original post was reported under the service account in the DB Mail log. –  Faisal Jul 17 '13 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.