Blog from Saravanan Arumugam

Let us talk about Technologies

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated


When I tried to send an email from .Net code, I got the following exception.

Exception

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated

Solution

This was because the mail was sent from the office network. By default the credentials in the SmtpClient object is null. The issue was resolved by setting SmtpClient.UseDefaultCredentials to true.

mailClient.UseDefaultCredentials = true;
Advertisements

8 responses to “The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated

  1. neeraj February 19, 2013 at 6:42 am

    Thanks for posting the answer…….you saved my time

    • Sebastin April 5, 2013 at 5:45 am
    • I tried the above solutuion, but still it shows the authentication error message..
  • Thembinkosi October 13, 2013 at 4:37 pm

    i also tried it it doesn’t work

    • ralph August 28, 2014 at 5:59 pm

      in VB .NET smtp.UseDefaultCredentials = True

  • ralph August 28, 2014 at 5:58 pm

    You are master thanks

  • zxczx January 2, 2014 at 2:54 am

    I tried the above solutuion, but still it shows the authentication error message..

  • Srikanth March 11, 2014 at 1:42 am

    same problem

  • Jyo Jo May 8, 2014 at 11:49 am

    Hi, it would be great if you also specify where this can be set. Always explain like you are doing to a lame person (like me:)) thanks.

  • Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: