I am trying to send an e-mail using c# MailKit SMTP (code below).
It connects successfully (with Connect
method) and then it fails on Authenticate
method call with an error " Username and Password not accepted.". I know the user name and password are correct. I also tried "mail.optusnet.com.au"
server on port 25 - same story.
What is wrong with my call to smtp.Connect
method. I have spent whole day experimenting and got nowhere. Can somebody help please.
// send email
using var smtp = new SmtpClient();
smtp.Connect("smtp.gmail.com", 587, SecureSocketOptions.StartTls);
smtp.Authenticate("rejkid@gmail.com", "Password1");
smtp.Send(email);
smtp.Disconnect(true);