Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
now the SMTP server requires a secure connection or the client was not authenticated to the server response was: 5.51 Client was not authenticated
Posted
Comments
Westlmorland 21-Mar-17 8:12am    
Try this:

using (SmtpClient smtp = new SmtpClient(" (e.g. smtp.gmail.com)", ConnectionSecurity.Ssl, true))
{
smtp.Connect();
Console.WriteLine("Connected.");

smtp.Authenticate("<username>", "<password>");
Console.WriteLine("Authenticated.");

// ...
}

The code uses this smtp client for c#.
Also here is a complete example on how you can send email in asp.net application with c# or vb.net.

Hi,

Try to set the SmtpClient.EnableSsl[^] property to true:
C#
yourSmtpClient.EnableSsl = true; // change 'yourSmtpClient' into the name of your SmtpClient

Hope this helps.
 
Share this answer
 
Try setting EnableSSL to true for your SMTP Client.
C#
smtpClient.EnableSsl = true;

Check a Tip here:
Tip/Trick: Enabling SSL on IIS 7.0 Using Self-Signed Certificates[^]

Or refer the links below for Similar Threads:
http://forums.asp.net/p/1156294/1899489.aspx#1899489[^]
http://forums.asp.net/p/1144253/1848821.aspx#1848821[^]
http://forums.asp.net/p/1117050/1736785.aspx#1736785[^]



--Amit
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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