I have an application that has been running upwards of 5 years without any issues. This morning I am no longer able to send emails using a specific Gmail account. The exception that I receive is: Unable to read data from the transport connection: net_io_connectionclosed. Using credentials for another account work fine. The account credentials have not changed and I am able to send emails from the account using the Gmail interface. I have contacted Google and their response was that the account looks ok, it must be your application... my response, the application has not changed and using other credentials work. My relevant code is below, any ideas?
try
{
SmtpClient smtpClient = new SmtpClient();
using (MailMessage message = new MailMessage())
{
message.From = new MailAddress(Program.EMAIL_SENDER_ADDRESS, "SENDER NAME");
message.To.Add(new MailAddress(Program.ERROR_RECIPIENT));
message.Subject = callingClass + " ERROR: " + subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "smtp.gmail.com";
smtpClient.Port = 587;
smtpClient.EnableSsl = true;
smtpClient.Credentials = new System.Net.NetworkCredential(Program.EMAIL_SENDER_ADDRESS, Program.EMAIL_SENDER_PASSWORD);
smtpClient.Send(message);
smtpClient.ServicePoint.CloseConnectionGroup(smtpClient.ServicePoint.ConnectionName);
}
}
catch (Exception x)
{
//handle exception
}
UPDATE - About 30 minutes after calling Google, it magically started working again. I guess the app fixed itself?!?!