I've been trying to get my application to send automated email by using a gmail account set up for the purpose, using SMTP. This is an account using Google Apps email, which uses the same servers as gmail for SMTP.
I have already enabled SMTP in gmail, and I'm using SSL like I should.
Also, my port 465 is not blocked for outgoing traffic.
Here is the code for my send mail method:
public static bool SendMail(MailMessage message)
{
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("admin@johnkiddapps.com", "********");
client.Host = "smtp.gmail.com";
client.Port = 465;
client.Timeout = 5000;
try
{
client.Send(message);
}
catch (SmtpException ex)
{
return false;
}
return true;
}

1 answers
I remember something similar when setting up gmail on an MS outlook install.
change your port to 587.
answered one year ago by:
753