hello,
I am using this email code it works fine, but after sending email i add Response.Redirect line so it gives error.
An asynchronous module or handler completed while an asynchronous operation was still pending.
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(smtp);
mail.From = new MailAddress(emailfrom, wsh.displayname);
//Email acpe = new Email();
mail.To.Add(mm.emailID);
mail.Bcc.Add(tcc);
StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath("~/Email/"));
string readFile = reader.ReadToEnd();
string myString = "";
myString = readFile;
myString = myString.Replace("{#abc}", "abc");
mail.Subject = "Email sending";
mail.IsBodyHtml = true;
mail.Body = myString.ToString();
SmtpServer.Port = port;
SmtpServer.Credentials = new System.Net.NetworkCredential(emailfrom, password);
SmtpServer.EnableSsl = false;
object userState = mail;
SmtpServer.SendCompleted += new SendCompletedEventHandler(SMTPClientForAsy.SmtpClient_OnCompleted);
SmtpServer.SendAsync(mail, userState);
Respons.Redirect("~/default");