Sending Email with CDOSYS in Classic ASP

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/

  • CDOSYS, classic asp, ASP
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Creating an Email Account

One of the benefits to owning your own domain is having the ability to create email addresses for...

Setting up a Default Address (catch-all)

In this video, we show you how to setup your default address or catch-all address.More...

Setting up Apache SpamAssassin

In this vide we outline how to use cPanel's Apache SpamAssassin interface which will help prevent...

Setting up Email Filters

In this video we should you how to setup email filters in your cPanel control panel.More...

Logging into Webmail

We'll show you how to login to your webmail in the following video tutorial. This tutorial is for...