im sending mail to one admin address and one mail sending to that person who entered details saying "thanks for contacting us." in second mail/receipent mail sending its getting error."insufficient system storage.The server response was: Too many emails per connection" in second method "SendConfirmationMail" its giving error. too many mails
private void SendMail()
{
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
System.IO.StreamReader r = null;
r = new System.IO.StreamReader(Server.MapPath("~/ContactMail.txt"));
string body = r.ReadToEnd();
MailMessage mail = new MailMessage();
mail.To.Add(new MailAddress("srinivas@gmail.com"));
mail.Body = body;
mail.IsBodyHtml = true;
//replacing txt file with dynamic content
body = body.Replace("<%Name%>", Name);
body = body.Replace("<%email%>", email);
body = body.Replace("<%message%>", message);
mail.Subject = "Applying For job";
mail.Body = body;
mail.IsBodyHtml = true;
SmtpClient MailServer = new SmtpClient();
MailServer.Send(mail);
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "clentscript", "alert('Thank u for contacting us..');", true);
}
private void SendConfirmationMail()
{
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
MailMessage mail = new MailMessage();
mail.To.Add(new MailAddress(email));
mail.Body = "Thank u for contacting us...";
mail.IsBodyHtml = true;
mail.Subject = "Thank you Mail";
mail.IsBodyHtml = true;
SmtpClient MailServer = new SmtpClient();
MailServer.Send(mail);
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "clentscript", "alert('Thank u for contacting us..');", true);
}
Aucun commentaire:
Enregistrer un commentaire