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
 General SQL Server Forums
 New to SQL Server Programming
 Get DBMail output

Author  Topic 

spareus
Yak Posting Veteran

52 Posts

Posted - 2013-05-31 : 10:30:48
With Query Anylyser, I am sending mails with DBMail successfully.
Each time mail is sent, bottom half window messages tab shows

"Mail (Id: 30242) queued."

Is there any way to capture Mail (Id: 30242) and update the same in a table?

Regards,


Regards,
Spareus

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2013-05-31 : 10:34:15
why do you want to catch the message.
If you are trying to track mail status then you can do it by querying the sysmail_allitems table in msdb database.

mohammad.javeed.ahmed@gmail.com
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-05-31 : 10:39:29
I don't know of a way to intercept the sp_send_dbmail to capture this information, but the id should be in msdb.dbo.sysmail_mailitems table (in the mailitemid) column.
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2013-05-31 : 12:13:09
Thanks for reply.
I want to track mail status for each receipeant.
msdb.dbo.sysmail_mailitems table can give me mail id but not with respect to receipeant.
I want to track each mail with the receipent. There may be multiple mail to each receipent so this treacking will help me a lot.

Regards,


Regards,
Spareus
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-05-31 : 12:22:24
quote:
Originally posted by spareus

Thanks for reply.
I want to track mail status for each receipeant.
msdb.dbo.sysmail_mailitems table can give me mail id but not with respect to receipeant.
I want to track each mail with the receipent. There may be multiple mail to each receipent so this treacking will help me a lot.

Regards,


Regards,
Spareus

msdb.dbo.sysmail_mailitems has not only mailitem_id and recients but many other pieces of information.
Go to Top of Page
   

- Advertisement -