Reputation: 2265
I want to send mail. I have following code which was working perfectly. But since few days, I am getting following error.
Error: Service not available, closing transmission channel. The server response was: Server busy, closing transmission channel. Try again later
Code:
try
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
using (MailMessage mm = new MailMessage("[email protected]", "[email protected]"))
{
mm.Subject = "Registration Successfully";
mm.Body = "You are registered successfully. Welcome.";
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "password");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
catch (Exception)
{
throw;
}
I have read following blogs and tried but didnt work.
1- Email alerts -while sending mail to multiple user 1 by 1 getting error as server busy
2- Send Bulk Email From Yahoo and Hotmail Using ASP.Net
Upvotes: 0
Views: 820
Reputation: 1455
don't use SMTP smtp.gmail.com
some times create problem
best solution
mm.Subject = "Registration Successfully";
mm.Body = "You are registered successfully. Welcome.";
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "domainname.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "password");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
Upvotes: 0