Click here to Skip to main content
15,889,768 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,

I am sending bulk emails using smtp.sendasync method. Some times it shows mail status as success but the emails are not received at destination. how to get status of undelivered mails with asyncronous method. Please suggest.

What I have tried:

String eid = username;
String pass = password;
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(eid, pass);
smtpClient.Host = "smtp.rediffmailpro.com";
smtpClient.Port = 587;
smtpClient.UseDefaultCredentials = false;
// smtpClient.EnableSsl = true;
smtpClient.Credentials = basicAuthenticationInfo;
try
{
//
smtpClient.SendCompleted += (s, e) => smtpClient.Dispose();
smtpClient.SendAsync(message, null);

//smtpClient.Send(message);
return true;
}
catch (Exception exc)
{
WriteToFile("Email Send Failure: {0} " + exc.Message + ". From Email Id " + msg.Headers.From.Address.ToString());
return false;
}
Posted
Updated 21-Nov-16 4:14am
Comments
F-ES Sitecore 21-Nov-16 9:00am    
You can't find out if the email has been delivered, asynchronous or not.

1 solution

You don't. Unless you use a read-receipt and the user actually send it back, there is no way for your code to determine if the mail was successfully sent or not.

The best you're going to get is a bounce message in the mailbox that you're using to send the emails from.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900