I cannot figure out for the life of my why this isn't working
SmtpClient smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
UseDefaultCredentials = false,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new NetworkCredential("myemail@gmail.com", "myGmailPasswordHere"),
EnableSsl = true,
Timeout = 10000
};
smtp.Send(mail);
I get:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
I just specified EnableSsl to true so that shouldn't be the issue in terms of secure connection.
I'm running this from localhost. And yes, my username and password I'm entering to auth (my gmail account credentials) is 100% right.
See Question&Answers more detail:os