Last post Oct 07, 2013 08:16 AM by er_abhi
Mar 09, 2009 07:26 AM|gaur1982|LINK
How we can calculate bounced mails or unsuccessful delivery mails count in asp.net and c#????
suppose i send 1000 mails at a same time by using this code
MailMessage obj = new MailMessage();
obj.From = new MailAddress(txtFrom.Text.Trim());
obj.Subject = txtSub.Text.Trim();
obj.IsBodyHtml = false;
obj.Priority = MailPriority.High;
obj.Body = txtMsg.Text.Trim();
obj.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
SmtpClient client = new SmtpClient("127.0.0.1", 25);
lit.Text = "Sent Sucessfully";
here tstTo textbox contains 1000 email id and in this most of fake id's.
so how i can count the numbers of bounced mails by using any code???
because i want to store number of mails sent, successful delivery and bounced mails but how????
Thanks & Regards,
Oct 07, 2013 08:16 AM|er_abhi|LINK
May be you can make it database driven. If mail is not getting send due to some error it can be catched in Catch block and within it may be u can retrive the email address which has thrown the error.
-> If your tstTo contains only 1 email address then probably before sending email store this in a database table with status false and if it gets sended successfully , update the status to true.
Hope it helps..