DavidJS
DavidJS

Reputation: 457

SSL error in Asp.Net MVC Smtp Attempt

I have an Asp.Net MVC 5.1 web application hosted on WIN 2008 R2 64-bit.

I have a wildcard godaddy SSL installed for my web application: *.mysite.com.

I attempt to send out emails from the website using this tag in my web.config:

<smtp from="myemail">
    <network host="mail.server.com"
             enableSsl="true
             port="25"
             defaultCredentials="false"
             userName="myuser" password="mypass" />
</smtp>

I get the following error:

System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to validation procedure at System.Net.Security.SSLState.StarteSendAuthResetSignal

If I change the property value of enableSsl = false , I am able to send emails but when is set to true it gives me error above.

Note: My SSL on the webserver is *.mysite.com. I am using the mail server: mail.server.com SSL connection... maybe I need to install the SSL from the mailserver to this webserver?

Upvotes: 1

Views: 731

Answers (1)

DavidJS
DavidJS

Reputation: 457

First issue was that my SSL certificate was not properly installed on the mailserver.

The second issue was not a firewall issue. Its a Microsoft .Net issue. The .Net uses System.Net.Mail to send out mail and it only supports Explicit SSL which means that by default the connection starts as unencrypted on port 25. At the moment it does not support port 465, I will either have to keep using port 25 or use a third party control to allow port 465 to work with my web application. –

Upvotes: 1

Related Questions