Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 DB Mail error logging

Author  Topic 

jimsurf
Starting Member

18 Posts

Posted - 2009-10-09 : 17:38:47
we are using db mail, and came across a problem because of a server move where the smtp server was no longer valid.

EXEC MSDB.DBO.SP_SEND_DBMAIL
@RECIPIENTS = 'xx@xx.com'
, @SUBJECT = 'test'
, @BODY = 'test body'
, @BODY_FORMAT = 'HTML'
The procedure did not throw an error and indicated that the mail had been queued. Then when looking at the sysmail_mailitems I noticed that the sent_status was set to 2, which indicates the email did not go out, and the sent_account_id was null.

The smtp server was set to mail.xxx.com
which did not resolve to a valid address

Is it possible to have this error write to the error log?
Which application would the error be related to?
How could you go about setting up a notification for this failure?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-09 : 18:09:22
I believe that you'd need to write custom monitoring around Database Mail and look for issues in the sysmail msdb tables. I don't believe that SQL Server has built-in monitoring for it.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -