I\'m having trouble sending email using my gmail account. Im pulling my hair out.
The same settings work fine in Thunderbird.
Here\'s the code. I\'ve also tr
This works, but it's not very performance friendly. Check out client.SendAsync: http://msdn.microsoft.com/en-us/library/x5x13z6h.aspx
An example use case:
var message = new MailMessage("from", "to", "subject", "body");
var client = new SmtpClient("smtp.gmail.com", 587)
{
Credentials = new NetworkCredential("login", "password"),
EnableSsl = true
};
client.SendCompleted += (s, e) =>
{
client.Dispose();
message.Dispose();
};
client.SendAsync(message, null);