Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to send an email, but I have an error message -

Quote:
System.Net.Mail.SmtpException: 'The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at'


What I have tried:

MailMessage message = new MailMessage("****@gmail.com", bl.BLFindCustomerMailByName(DDLUser.SelectedValue));
message.Body = mail;
message.Subject = title;
message.IsBodyHtml = true;
NetworkCredential mailAuthentication = new NetworkCredential("****@gmail.com", "***");
SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 587);
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(message);
Posted
Updated 28-Apr-20 7:23am

1 solution

GMail is a real pain to work with since they have extended their own set of permissions on top of the already extended SMTP requirements

The first thing I would check is the security settings you have for the gmail account you are trying to send from; specifically those involvingAllow Less secure apps[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900