Resending email in SendCompleted Event
<p>I have a class called SchedulerService, and in it I have a SendMail function that's called when an email needs to be sent at a certain time. When I call the SendMail function, I pass in an object which holds the information for who to send the email to and who the email is from. Now, I've added a SendCompleted Handler so that I can possibly resend the email, in case something happens that causes it not to. I have this code that sends the mail: </p>

<pre><code>    var recipients = EmailTo.Split(',').ToList();
    if (String.IsNullOrEmpty(EmailFrom))
        EmailFrom = recipients[0];

    using (MailMessage message = new MailMessage())
      {
        message.From = new MailAddress(EmailFrom);
        recipients.ForEach(a =&gt; message.To.Add(new MailAddress(a)));
        message.Attachments.Add(new Attachment(LocationOfResults));
        message.Subject = String.Format("{0:MM-dd-yyyy} Results for task: {1}.", DateTime.Now, Description);
        message.Body = "Attached is the results file specified for the task: " + Description;
        smtpClient.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
        smtpClient.UseDefaultCredentials = true;
        smtpClient.SendAsync(message, null);

                }
</code></pre>

<p>This is the event handler</p>

<pre><code>    private void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
    {
        if (e.Cancelled)
        {
            MailMessage mail = (MailMessage)e.UserState;
            using (mail)
            {
                 smtpClient.Send(mail);
            }
        }
        if (e.Error != null)
        {
            Log(e.Error.ToString() + " in SendCompletedHandlerEvent", EventLogEntryType.Error);
        }

    }
</code></pre>

<p>Problem is, I discovered that doing that doesn't work, as the To and From fields are empty, which then causes an error when sending the email. How should I go about reclaiming the To/From fields from the email that failed to send? </p>
