Search code examples
sql-serversql-server-2008database-mail

Database Mail in Sql Server 2008 not working


I am using Database Mail feature of SQL Server 2008 for the first time to send mail.

I followed the steps in Example

All seems good. Send status in

SELECT * FROM sysmail_allitems 

is sent.

But the recipient hasn't received any mail..

What could be the issue?


Solution

  • There is a role called DatabaseMailUserRole in SqlServer your user must have access to it to send the mail through Database Mail in Sql Server

    To see which users have access: EXEC msdb.sys.sp_helprolemember 'DatabaseMailUserRole';

    To add user to this required role: EXEC msdb.sys.sp_addrolemember @rolename = 'DatabaseMailUserRole' ,@membername = 'userName';

    Then execute the command to send mail.