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.
I now need to use an SSL connection. I have created a security certificate and set hmail server to use port 465 and ssl.
However, for some reason when I try to send the form I get an error 500 and the email is not sent.
I have tried with port 587 as well but it doesn't work either.
The CDO code I use is as follows:
If request.Form("submit") <> "" then
Set myMail=CreateObject("CDO.Message")
myMail.Subject="xxxxxxx"
myMail.From=Request.Form("email")
myMail.To= "xxxxxxxxxxx"
myMail.TextBody = "Name:"& Request.Form("name")& vbcrlf & vbcrlf & _
"Email:" & Request.Form("email") & vbcrlf & vbcrlf & _
"Telephone:" & Request.Form("telephone") & vbcrlf & vbcrlf & _
"Location:" & Request.Form("location") & vbcrlf & vbcrlf & _
"Other location:" & Request.Form("other_location") & vbcrlf & vbcrlf & _
"Comments:" & 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
Does anyone have an idea what can be wrong?
Thank you.
This post is a bit old, did you already solve it?
If not, can you provide the error message (other than the generic 500)?
I only have 2 possible ideas without seeing the actual error message:
1) It could be timing out. Try adding myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
2) Perhaps there is a certificate mismatch with the "127.0.0.1" IP address and so SSL communications is being refused.
I had the same problem working with Legacy ASP Code. The following Code works with Amazon. Note: Only Port 25 or 465 seems to work and smtpusessl = 1 (in VBScript True==-1)