Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

The remote certificate is invalid according to the validation procedure.

Posted on 2016-11-14
14
Medium Priority
?
251 Views
Last Modified: 2016-11-23
I'm trying to send an email from an ASP.NET (VB) web page via my hosting companies mail server, but getting the above error. They are telling me that they do not allow plain text mail and I must send using SSL, I have included enableSSL in my web.config setting as follows:

<mailSettings>
      <smtp from="from@my.com">
        <network host="server IP" port="587" userName="from@my.com" password="password" enableSsl="true"/>
      </smtp> 
    </mailSettings>
 

Open in new window


What am i missing?
0
Comment
Question by:BrianFord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
  • 2
14 Comments
 
LVL 20

Expert Comment

by:Peter Hutchison
ID: 41887506
Are you using a Public SSL certificate on your web site for your domain (my.com)?
0
 

Author Comment

by:BrianFord
ID: 41887671
Not sure I understand where the cert should be?

Should the cert be on my development laptop (where my aspx page) is running? or are you referring to the mail server itself?

 I have no access to the mail server.
0
 
LVL 20

Expert Comment

by:Peter Hutchison
ID: 41887693
The certificate should be placed on the server, where the messages are being sent from.

If you are sending the mail messages from a development site on your laptop as well, then you should have a certificate installed there too linked to your computer's FQDN name. You can either get one from a internal CA, a self-signed cert (if allowed) or from a public CA service.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:BrianFord
ID: 41887778
On my dev laptop I don't have full-blown IIS installed.

When I run the project in Visual Studio it's basically an IIS Express website running on 'localhost:random port' can a cert be created for that?
0
 

Author Comment

by:BrianFord
ID: 41887881
So,

I installed IIS on my local PC and have installed a Self-Signed cert, when I navigate to my local site using HTTPS, everything is good, but when I try to send the email I still get the same error
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 41887953
The key here is the word "remote" in the error message. Your local certificate situation should not have any bearing on this. You may need to verify what protocol suite(s) the hosting company's server uses. I would also check that they are using a valid certificate (as opposed to self-signed certificate) to secure their server. Maybe they have their own certificate authority and you have to update your server (or local machine) with their certificate authority info.
0
 

Author Comment

by:BrianFord
ID: 41888080
I thought that might be the case, their support is not being overly helpful :( their only suggestion to me was to include enableSSL='true" in my we-congig, which I did to no avail.

I would think their certs are valid as they are a large hosting company (www.hostdime.com) and I can't imagine I'm the only tryng to do this,. at this point I'm basically stumped :(
0
 
LVL 20

Expert Comment

by:Peter Hutchison
ID: 41888098
Looks like they offer SSL services http://www.hostdime.com/services/ssl-certificates/ 
Instructions on ordering a SSL cert here: http://www.hostdime.com/resources/order-ssl-via-core/ 
Instructions on installing cert here: http://www.hostdime.com/resources/install-ssl-via-whm/
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 2000 total points
ID: 41888193
Based on this page:

https://www.hostdime.com/resources/disable-plain-text-authentication/

...does it work if you use port 465?
0
 

Author Comment

by:BrianFord
ID: 41888249
Unfortunately not, but was worth a try :(  same error
0
 

Author Comment

by:BrianFord
ID: 41888260
actually, I had a typo in the port, 465 results in a timeout :(
0
 

Author Comment

by:BrianFord
ID: 41888268
This is what I'm using to send the email:

 Dim strFrom = "user@xxxx.com"
        Dim strTo = "me@mydoamin.com"
        Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))

        MailMsg.BodyEncoding = Encoding.Default
        MailMsg.Subject = "Test Mail"
        MailMsg.Body = "This is a test email"
        MailMsg.Priority = MailPriority.Normal
        MailMsg.IsBodyHtml = True

        Dim SmtpMail As New SmtpClient
        Dim authenticationInfo As New Net.NetworkCredential("user@xxxx.com", "pwd here")

        SmtpMail.Host = "72.29.68.31"
        SmtpMail.Port = "465" ' also try 587
        SmtpMail.UseDefaultCredentials = False
        SmtpMail.EnableSsl = True
        SmtpMail.Credentials = authenticationInfo

        Try
            SmtpMail.Send(MailMsg)

        Catch ex As Exception
            Dim x As String = ex.Message
            lblInvalidCreds.Text = ex.Message
            lblInvalidCreds.Visible = True

        End Try

Open in new window

0
 

Accepted Solution

by:
BrianFord earned 0 total points
ID: 41893805
Issue turned out to be that the .NET System.Net.Mail does not support 'ImplicitSSL' running on port 465.

I changed to System.Web.Mail (which unfortunately is deprecated) but still works

For anyone with the same issue, the following code worked for me:

 
Dim myMail As New MailMessage()

        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", pServer)
        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465")
        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2")

        'sendusing: value 2, for sending the message using the network.
        'smtpauthenticate: Specifies the mechanism used when authenticating to an SMTP service over the network.
        ' Possible values are:
        ' 0 = Do Not authenticate.
        ' 1 = Use basic clear-text authentication, When using this option you have to provide the user name and password through the sendusername and sendpassword fields.
        ' cdoNTLM, value 2. The current process security context is used to authenticate with the service.

        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'Use 0 for anonymous
        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", pUserName)
        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pPwd)
        myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true")
        myMail.From = pMailFrom
        myMail.[To] = pMailTo
        myMail.Subject = pSubject
        myMail.BodyFormat = MailFormat.Html
        myMail.Body = pBody

        'If pAttachmentPath.Trim() <> "" Then
        '    Dim MyAttachment As New MailAttachment(pAttachmentPath)
        '    myMail.Attachments.Add(MyAttachment)
        '    myMail.Priority = System.Web.Mail.MailPriority.High
        'End If

        SmtpMail.SmtpServer = pServer & ":465"

Open in new window

0
 

Author Closing Comment

by:BrianFord
ID: 41898880
c
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question