How to send mail using CDO

Programming, error messages and sample code > sample code
NOTICE:  Trial account does not have SMTP service. Therefore, you cannot test this in your trial account. We do this to prevent spammer from taking advantage of our Free Trial Service.

You should use the smtp server assigned to your account "mail.yourdomain.com" as the SMTP outgoing server for your web applications(Replace yourdomain.com to your own domain name). 

To get your SMTP server setup, please follow the below:
1) Login to your control panel
2) Make sure a domain name is added to your account by going to Hosting Control Panel -> Website Domain Manager
3) Once the domain name is added to your account, go to Hosting Control Panel -> Email Manager and activate your email service for your domain name.
4) Create the necessary email account that you need.  Your script MUST send from an valid Email account. So create the ones you need.
5) Done! Please follow below's code sample to send emails.

YOU MUST USE SMTP AUTHENTICATION 




set objMessage = createobject("cdo.message") 
set objConfig = createobject("cdo.configuration") 
Set Flds = objConfig.Fields 
 
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yourdomain.com" 
 
' ' Passing SMTP authentication 
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication 
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="postmaster@yourdomain.com" 
''IMPORTANT: This must be same as your smtp authentication address.

Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password" 
 
Flds.update 
Set objMessage.Configuration = objConfig 
objMessage.To = "postmaster@yourdomain.com" 
objMessage.From = "postmaster@yourdomain.com"   ''IMPORTANT: This must be same as your smtp authentication address.
objMessage.Subject = "New Task" 
objMessage.fields.update 
objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication." 
objMessage.Send 
%>