I am developing an Asp.Net application, where I am sending a mail to the user's email address, if he forgets the password.
I want to check if the mail has been sent sucessfully or not. Is there any method to know that for sure.
EDIT
In case if an email id does'nt exists, then would I detect a failure.
No. E-mail (SMPT based) is an unreliable transport protocol and although there are some hacks to detect that an e-mail has been received and read, e.g. by embedding an individualized image URL in the e-mail and tracking that the image has been requested by the recipient's client, there is no absolutely reliable way to fulfil your request.
if your
SmtpMail.Send(message)
method returns no error, it means the email was sent to the SMTP server, then you are out of your jurisdiction, that is how far you can know.If you're using System.Net.Mail try out
I'am using gmail SMTP for sending mails with my program. A fake mail sent returns Ok even with SmtpFailedRecipientException trap.
But when I check with outlook my gmail recipient I see that mail was not sent with explanation. With a subject Delivery Status Notification (Failure)
My question is it possible to get this notificiation whitin the program.
I found this but it's not for POP
Notify C# Client, when SMTP Server receive a new Email
Put the .Send(msg) method in a try catch block, and catch SmtpFailedRecipientException.
According to spec:
As soon as server says
250 Ok: queued as 12345
, you cannot know for sure if it had really sent an email or not, or whether it was delivered.