Author |
|
raosid Newbie
Joined: 26 February 2009 Location: India
Online Status: Offline Posts: 1
|
Posted: 26 February 2009 at 10:01am | IP Logged
|
|
|
Hi,
I am trying to catch the bounce emails in a small function. something like this:
Smtp.LicenseKey = "eeee-eeeeeeeeeeeeeeeeeeeeeeeeee-eeee";
Smtp mailer = new Smtp(); mailer.DeliveryNotification.TrackingID = "Jan2007_##ID##";
mailer.SmtpServers.Add("mail.vvv.com", "v@v.com", "vvvv", AuthenticationMethods.Auto);
string failedIndices = null;
DataTable table = new DataTable();
table.Columns.Add("emails");
table.Rows.Add("siddhah.a@678575lutions.com");
table.Rows.Add("siddhu.1983@gmail.com");
table.Rows.Add("siddha@56575675.com");
for (int i = 0; i < table.Rows.Count; i++)
{
mailer.From.AsString = "aaa@sss.com";
mailer.To.AsString = table.Rows[0].ToString();
mailer.Subject = "Weekly newsletter";
mailer.BodyPlainText = "This is the newsletter contents";
if(mailer.TestSend(SendFailureThreshold.AllRecip ientsFailed) != TestSendResult.OK)
mailer.AddJob(null, "v@v.com", null);
}
mailer.SendJobs();
string notifications = "", notificationf="";
for (int i = 0; i < mailer.JobsSuccessful.Count; i++)
{
for (int j = 0; j < mailer.JobsSuccessful.Recipients.Count; j++)
{
if (notifications == "")
notifications = "mails sent to <br/>" + (i + 1) + ". " + mailer.JobsSuccessful.Recipients[j].Email;
else
notifications += "<br/>" + (i + 1) + ". " + mailer.JobsSuccessful.Recipients[j].Email;
}
}
Response.Write(notifications);
for (int i = 0; i < mailer.JobsFailed.Count; i++)
{
for (int j = 0; j < mailer.JobsFailed.Recipients.Count; j++)
{
if (notificationf == "")
notificationf = "<br/>mails not sent to <br/>" + (i + 1) + ". " + mailer.JobsFailed.Recipients[j].Email;
else
notificationf += "<br/>" + (i + 1) + ". " + mailer.JobsFailed.Recipients[j].Email;
}
}
Response.Write(notificationf);
But, its sending mails to everybody. How can i track which emails are sent and which are failed? Can someone please provide a code ?
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 27 February 2009 at 2:53am | IP Logged
|
|
|
If all the jobs go to mailer.JobsSuccessful, that means your SMTP relay server accepted all the messages successfully. That's ordinary occurrence. Further delivery is concern of the relay SMTP server.
To catch bounce messages, you need to poll (through POP3 or IMAP) the account the messages are sent from. To learn more about processing bounce messages, please refer to this tutorial. Delivery notifications are sent back to sender's address too.
Best regards,
Andrew
|
Back to Top |
|
|