Here I am giving some step to troubleshoot Database Mail related problems
Cant find sp_send_dbmail procedure
This procedure is in MSDB database.
User does not have permission on sp_send_dbmail
Run
EXEC msdb.dbo.sp_addrolemember @rolename = 'DatabaseMailUserRole',
@membername = '' ;
Service broker is needed to activate external program which sends queued mails, else mail will be queued but will not be deliverd.
To check if service broker is enabled we need to run
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb'
If its not enabled , we need to enable by this query.
ALTER DATABSE MSDB SET ENABLE_BROKER
If database mail procedures are not enabled enable it using surface area configuration
To check status of database mail procedures
EXECUTE dbo.sysmail_help_status_sp ;
To start database mail
EXECUTE dbo.sysmail_start_sp ;
SQL Server is using external application Databasemail90.exe , which connect to server using windows authentication and send mail
We can find it on
MSSQL.3\mssql\binn
Even after this if Database Mail does just queued mails and do not send them.
We have to check by running this application manually. If it sends mails then it means service broker is not starting this application.
Run this code in MSDB
ALTER QUEUE [InternalMailQueue] WITH ACTIVATION (
STATUS = ON,
PROCEDURE_NAME = [dbo].[sp_ExternalMailQueueListener],
MAX_QUEUE_READERS = 1,
EXECUTE AS OWNER);
ALTER QUEUE [ExternalMailQueue] WITH ACTIVATION (
STATUS = ON,
PROCEDURE_NAME = [dbo].[sp_sysmail_activate],
MAX_QUEUE_READERS = 1,
EXECUTE AS OWNER)
This procedure is in MSDB database.
Run
EXEC msdb.dbo.sp_addrolemember @rolename = 'DatabaseMailUserRole',
@membername = '
To check if service broker is enabled we need to run
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb'
If its not enabled , we need to enable by this query.
ALTER DATABSE MSDB SET ENABLE_BROKER
To check status of database mail procedures
EXECUTE dbo.sysmail_help_status_sp ;
EXECUTE dbo.sysmail_start_sp ;
We can find it on
MSSQL.3\mssql\binn
We have to check by running this application manually. If it sends mails then it means service broker is not starting this application.
Run this code in MSDB
ALTER QUEUE [InternalMailQueue] WITH ACTIVATION (
STATUS = ON,
PROCEDURE_NAME = [dbo].[sp_ExternalMailQueueListener],
MAX_QUEUE_READERS = 1,
EXECUTE AS OWNER);
ALTER QUEUE [ExternalMailQueue] WITH ACTIVATION (
STATUS = ON,
PROCEDURE_NAME = [dbo].[sp_sysmail_activate],
MAX_QUEUE_READERS = 1,
EXECUTE AS OWNER)
2 comments:
Hi,
I am getting different kind of error in sending database mail from SQL server 2005 which is not included in troubleshooting database mail.
I am getting the error as per the log file
"Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 5 (2009-06-01T11:03:23). Exception Message: Cannot send mails to mail server. (Command not implemented. The server response was: Error: command not implemented).
)"
Using the same SMTP server info and same steps I am able to send test mail from different servers. But in a particular server I am not able to send test database mail but I am able to send message through cmd prompt using telnet command.
Please advice any server setup needs to be checked.
Is it private profile?
Is SMTP Server is blocked by Firewall?
Post a Comment