I am trying to move a script that uses CDO over from using SMTP.com mail relay to using Amazon SES service.
The code was working previously with SMTP, but the configuration of SMTP.com was set to allow all requests from the web server IP that the code is sitting on. With Amazon SES this isnt possible and you have to authenticate. SES doesnt allow anything but SSL/TLS connections, hence why i think its failing.
The code is:
Set Mail = CreateObject("CDO.Message") Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "email-smtp.us-east-1.amazonaws.com" Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= 465 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") ="un" Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="pw" 'update the configuration options Mail.Configuration.Fields.Update Mail.From = "info@xxx.com" Mail.To = strSendTo Mail.Bcc = Bcc Mail.Cc = Cc Mail.Subject = strSubject IF BodyFormat = 1 THEN Mail.TextBody = strMessage ELSEIF BodyFormat = 0 THEN Mail.HtmlBody = strMessage END IF Mail.SendSet Mail = Nothing
One last option that I have resorted to is to use an sdk that already exits like php. Then set up a php page to do the work for you as your own web service where you can post data to via classic asp xmlhttpost. It can be a lot easier than trying to program the long way in classic asp.
Another options is to use the aws api http://docs.aws.amazon.com/ses/latest/APIReference/API_SendEmail.html
You can simply use xmlhttppost to send the data
Open in new window