locked
Callback not triggered for AsyncMail RRS feed

  • Question

  •  Hi Guys, I am sending mail with the following code(not full)

    SC.SendCompleted += new SendCompletedEventHandler(SmtpClient_OnCompleted);
    SC.SendAsync(Mailer, UserState);


    public static void SmtpClient_OnCompleted(object sender, AsyncCompletedEventArgs e)
    {
    AppendDebug(
    "Callback");
    System.Net.Mail.MailMessage mail = (System.Net.Mail.MailMessage)e.UserState;

    if (e.Error != null)
    {
    MessageBox.Show("SNM CallBack Errors" + mail.Subject + " " + e.Error.ToString());
    }
    else
    {
    MessageBox.Show("SNM CallBack no errors" + mail.Subject);
    }
    }


    But my callback procedure only gets called sometimes... Most of the time it does not. The AppendDebug function just writes to disk.

    Anyone know why that might be?

    Lawrence

    Tuesday, July 22, 2008 11:19 AM