A
AA2e72E
I am using System.Net.Mail to send mail asynchronously. I have an event
handler that gets trigerred when the task is completed.
One of the arguments of the event handler has a method UserState; UserState
gets a unique GUID for the asynchronous task.
How do I get this GUID when (or before) I send the mail? I'd like to record
the GUID in a database table and then from the event handler, update the row
with the outcome reported by the argument e.
Thanks.
SmtpClient client = new SmtpClient(mailClient);
client.SendCompleted += new SendCompletedEventHandler(MailDeliveryComplete);
public void MailDeliveryComplete(object sender,
System.ComponentModel.AsyncCompletedEventArgs e)
{
LogMessage("Message token = " + e.UserState);
}
handler that gets trigerred when the task is completed.
One of the arguments of the event handler has a method UserState; UserState
gets a unique GUID for the asynchronous task.
How do I get this GUID when (or before) I send the mail? I'd like to record
the GUID in a database table and then from the event handler, update the row
with the outcome reported by the argument e.
Thanks.
SmtpClient client = new SmtpClient(mailClient);
client.SendCompleted += new SendCompletedEventHandler(MailDeliveryComplete);
public void MailDeliveryComplete(object sender,
System.ComponentModel.AsyncCompletedEventArgs e)
{
LogMessage("Message token = " + e.UserState);
}