1

I am trying to automate an email in C# asp.net 4.0 project with an exchange server and I am receiving the error:

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

The system administrator has assured me that there is no credentials set up so I am using the default credentials. I have set up my code as followed.

System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("exchange.XXX.lan", 25);
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("Foo@XXX.com",
                                  "Foo@XXX.com",
                                  "test",
                                  "TEST!");

client.UseDefaultCredentials = true;
client.EnableSsl = true;
client.Send(msg);

And my Configuration file as:

<system.net>
    <mailSettings>
      <smtp from="helpdesk@XXX.com">
        <network host="exchange.XXX.lan" port="25" defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>
  • Hmmm, maybe your system administrator is wrong or liying? XD Did you tried to connect with a simple smtp client program and got it sent? – Gusman May 30 '14 at 13:33
  • possible duplicate of [SMTP Authentication with config file's MailSettings](http://stackoverflow.com/questions/3621169/smtp-authentication-with-config-files-mailsettings) – JMK May 30 '14 at 13:35

0 Answers0