title: Sending a CDO email message using an SSL connection
body: <p>I have an asp page that sends the details of a form via email using CDO. So far, I have done this using smtp port 25 over a clear connection to a hmail server.</p>
  
  <p>I now need to use an SSL connection. I have created a security certificate and set hmail server to use port 465 and ssl.</p>
  
  <p>However, for some reason when I try to send the form I get an error 500 and the email is not sent.</p>
  
  <p>I have tried with port 587 as well but it doesn't work either.</p>
  
  <p>The CDO code I use is as follows:</p>
  
  <pre><code>If request.Form("submit") &lt;&gt; "" then
  
  Set myMail=CreateObject("CDO.Message")
  myMail.Subject="xxxxxxx"
  myMail.From=Request.Form("email")
  myMail.To= "xxxxxxxxxxx"
  
  myMail.TextBody = "Name:"&amp; Request.Form("name")&amp; vbcrlf &amp; vbcrlf &amp; _
  
  "Email:" &amp; Request.Form("email") &amp; vbcrlf &amp; vbcrlf &amp;  _
  
  "Telephone:" &amp; Request.Form("telephone") &amp; vbcrlf &amp; vbcrlf &amp; _
  
  "Location:" &amp; Request.Form("location") &amp; vbcrlf &amp; vbcrlf &amp; _
  
  "Other location:" &amp; Request.Form("other_location") &amp; vbcrlf &amp; vbcrlf &amp; _
  
  "Comments:" &amp; Request.Form("comments")
  
  myMail.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
  'Name or IP of remote SMTP server
  myMail.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
  ="127.0.0.1"
  'Server port
  myMail.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
  =465
  MyMail.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  myMail.Configuration.Fields.Update
  myMail.Send
  set myMail=nothing
  </code></pre>
  
  <p>Does anyone have an idea what can be wrong?</p>
  
  <p>Thank you. </p>