I am trying to send an email using SMTP client using my gmail credential. This is the code am using
using (var mail = GetMailInfo())
{
using (SmtpClient client = new SmtpClient("smtp.gmail.com", 465))
{
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential("**@gmail.com", "Password");
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Send(mail);
}
}
I receive a time out error
The operation has timed out
If I try again I get another error saying
Service not available, closing transmission channel. The server response was: Too many concurrent SMTP connections; please try again later.
What am I doing wrong?