Support - Knowledge base

Giving you the answers you need

Why not try our knowledge base for instant help and advice to enhance your online experience with Register365? From within the knowledge base you can browse our frequently asked questions and find the right answers to help solve your queries.

Home  >  Scripting  >  ASP (Active Server Pages)  >  View Article

Example working CDO html email script

Not enough ratingsNot enough ratingsNot enough ratingsNot enough ratingsNot enough ratings

Article

<% 
' Example mail script to send HTML email using CDO 
CONST SMTPServer = "localhost" 
CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/" 
CONST FromAddress = "web@example.com" 
CONST FromName = "My Website" 
CONST ToAddress = "another@example.com" 
CONST ToName = "Mr R.E.Cipient" 
CONST Subject = "Test HTML Email" 
CONST url = "http://www.register365.com" 
htmlbody = "<html><body>Please <a href='" & url & "'>register</a>.</body></html>" 
textbody = "Please register:" & vbCrLf & url   
set cdoM = CreateObject("CDO.Message") 
set cdoC = CreateObject("CDO.Configuration") 
set cdoF = cdoC.Fields 
With cdoF 
.Item(cdoURL & "sendusing") = 2 
.Item(cdoURL & "smtpserver") = SMTPServer 
.Item(cdoURL & "smtpconnectiontimeout") = 10 
.Update   
End With   
With cdoM 
Set .Configuration = cdoC 
.From = FromAddress 
.To = ToAddress 
.Subject = Subject   
.HTMLBody = htmlbody 
.TextBody = textbody 
.Send   
End With  
set cdoM = Nothing   
set cdoS = Nothing   
set cdoF = Nothing  
%>

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed