Solved

how to get Sql Database Email confirmation status

Posted on 2010-08-24
3
887 Views
Last Modified: 2013-11-30
Hi Experts,

I have created a scheduled job, which sends emails using msdb.dbo.sp_send_dbmail.
I can successfully send emails, now I want to find whether that email is been sent sucessfully or not, and it is delived.
I can get a sent_status from msdb.dbo.sysmail_mailItems table, but I want to have the exact delivery status.

Is any way I can find this ?
0
Comment
Question by:RETAILREALM
  • 2
3 Comments
 
LVL 6

Expert Comment

by:robbe
ID: 33508588
You can use:

EXECUTE msdb.dbo.sysmail_help_queue_sp ;
GO

more info on:
http://technet.microsoft.com/en-us/library/ms187400.aspx
0
 

Author Comment

by:RETAILREALM
ID: 33508856
Hope I am not missing something there,
but can you specify how I can get that , in 10 emails these 9 are sent , 1 is in queue, 8 are successfully delivered and 1 is failed.

I cant see any clue by using above store procedure.

Thanks, please correct me if I am wrong.
0
 

Accepted Solution

by:
RETAILREALM earned 0 total points
ID: 33509589
ok, I found it

http://technet.microsoft.com/en-us/library/ms191278(SQL.90).aspx

which sayss
Database Mail keeps copies of outgoing e-mail messages and displays them in the sysmail_allitems, sysmail_sentitems, sysmail_unsentitems, sysmail_faileditems views of the msdb database. The Database Mail external program logs activity and displays the log through the Windows Application Event Log and the sysmail_event_log view in the msdb database. To check the status of an e-mail message, run a query against this view. E-mail messages have one of four possible statuses: sent, unsent, retrying, and failed.


And its perfect answer.


 
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now