Sending Email with CDOSYS in Classic ASP imprimir

  • CDOSYS, classic asp, ASP
  • 3

You can send email with CDOSYS on your Windows ASP account using the following example.
Please update the neccessary fields marked in bold below with your actual details.


<% 'Create the e-mail server objectSet objCDOSYSMail = Server.CreateObject("CDO.Message")Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Set and update fields properties
With objCDOSYSCon

' Specify the authentication mechanism to basic (clear-text) authentication cdoBasic = 1
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'SMTP Server username
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "you@your-email-here.com"

'SMTP Server password
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YourPasswordHere"

'Out going SMTP server
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"

'SMTP port
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'CDO Port (1=localhost 2=network)
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

'Timeout
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

.Fields.Update
End With

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

With objCDOSYSMail

'Who the e-mail is from
.From = "<you@your-email-here.com>"

'Who the e-mail is sent to
.To = "<to@to-email-here.com>"

'The subject of the e-mail
.Subject = "Website Enquiry"

'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
.HTMLBody = "this is the body"
'.TextBody = "this is the body"

'Send the e-mail
.Send

End with

'Close the server mail object Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing %>
NOTE: SMTP authentication is required to send email locally from the server. If you have any issues getting this to work, then please contact us for further assistance.

Looking for reliable Windows hosting with Award Winning Customer Support?
Grab your hosting today with a 20% discount. All plans come with our 60 Money Back Guarantee!

Check out our plans & promotions on our website -- https://www.peopleshost.com/


Esta resposta lhe foi útil?

« Retornar