Sending email asynch

Discussion in 'Email' started by bkillins, Jan 12, 2011.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm wanting to send email asynch from my web app. If I send within that thread it works, but if I send asynch it fails. Following is a code snippet.

    MailMessage message = new MailMessage(from, mTo);
    message.Subject = sSubj;
    message.Body = sBody;
    message.IsBodyHtml = true;
    SmtpClient client = new SmtpClient(sSMTPServer);
    System.Net.NetworkCredential nc = new System.Net.NetworkCredential(sSenderEmail, sSenderPass);
    client.Credentials = nc;
    client.Port = 587;
    //client.EnableSsl = true;

    client.SendCompleted += new SendCompletedEventHandler(client_SendCompleted);
    client.SendAsync(message, "\"Sending..\"");
    //client.Send(message);
     
  2. Are you getting any specific errors? This way we can have the general idea of what is going wrong here.

    In the majority of cases I can say it's likely to be some SMTP setting being incorrect.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page