Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

On a SQL Server 2005 machine, I have DBMail setup and correctly configured. I am able to use "Notify Operator" and EXEC msdb.dbo.sp_send_dbmail to queue emails.

But the problem is the queued mails never go through. I see 10 emails in the queue when I query

SELECT * FROM msdb.dbo.sysmail_unsentitems

But if I restart the SQL Server service, all mails go through and I receive emails in my inbox.

So far this is the only pattern I could find.

So my question is: is there a way to troubleshoot DBmail? I read some steps on MSDN, but they are not of much help. Any URLs to articles that could help are much appreciated.

share|improve this question
add comment

2 Answers

Have you start the service broker on MSDB ? You need the service broker on to be able to process mail queue.

Read this post on Stackoverflow. An other link that may help you is how to troubleshoot a queue in sql. You can also use this link to get your service broker up and running on MSDB.

Hope that those links may help you.

share|improve this answer
    
Thank you, I will try your suggestions and post my results. –  UB01 May 12 '11 at 2:24
    
yes, I did try all of those. Everything returned as STARTED or running okay. Looks like the problem is with Sql Agent Alert System settings. See below –  UB01 May 12 '11 at 18:04
add comment
up vote 3 down vote accepted

Thank you for all your comments. I found the root of the problem.

Sql Agent >> Properties >> Alert System (tab) >> Enable Mail profile (check) And select appropriate mail system and add a mail profile.

MSDN Link for DB Mail

This took care of the problem.

When I look at Sql Agent Logs it had a log entry as "Unable to start mail session (reason: no mail profile defined)". Using this key word, I was able to search online and get some help.

share|improve this answer
    
Everything is now fine. :-) –  Nico May 13 '11 at 0:02
    
Yes it seems like it. –  UB01 May 24 '11 at 17:36
add comment

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.