I'm trying to send emails with classic ASP and IIS 8.5 for that I use SMTP Service (no SMTP Server) in IIS and a email account from Gmail.
The error message when I'm testing the page is:
CDO.Message.1 error '80040213' Error de transporte en la conexión al servidor. /anotala/prueba-Email.asp, línea 38
Mys ASP code is:
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.gmail.com"
.Item(cdoSMTPServerPort) = 25
'.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "emailaccount@gmail"
.Item(cdoSendPassword) = "pwd123"
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = "[email protected]"
.From = "[email protected]"
.Subject = "Prueba Nro. 1"
.TextBody = "Este es el cuerpo de la prueba Nro. 1"
.Send
End With
And this is the configuration of the IIS:
I would like to know where is the problem and How can I solve it?
http://www.w3schools.com/asp/asp_send_email.asp https://support.google.com/a/answer/176600?hl=es
From your code it seems as if you are setting up your smtp connection in the code over using your IIS configuration. I do not believe you can use your IIS configuration with CDOSYS (see the answer here: https://stackoverflow.com/a/6489539/3915817). You alrerady have it properly set up in your code but this line
.Item(cdoSMTPServer) = "smtp.gmail.com"
Indicates that you are using the SSL only version of google's smtp connection. This is actually good as you likely want to encrypt your username and password anyhow and not send them in plain text. You need to tell CDOSYS to use SSL though. you can do that by first using the correct port based on Google's API so I would change this your port line to:
.Item(cdoSMTPServerPort) = 465
and then you need to set up enabling SSL adding another constant
Const cdoSendTLS = "http://schemas.microsoft.com/cdo/configuration/smtpusessl"
and add the item line to your fields block like so
.Item(cdoSendTLS) = 1
Sources:
http://webcheatsheet.com/asp/sending_email_asp.php#remoteservergmail