HOWTO: Send a mail using CDONTS

<%
'declare variables for the mail object (oMail) and the email body (strEmailBody)
Dim oMail, strEmailBody

'Create the CDO object
Set oMail = Server.CreateObject("CDONTS.NewMail")

'places body of the email into the variable strEmailBody, formatted using 'HTML
strEmailBody = "<html><head><h3>CDONTS Example</h3></head>" _
&"<body>This request was submitted at " & Time & " on " & Date _
&"<p>From: " & Request.Form("name") & "</p><p>Email: " _
&Request.Form("email") & "</p><p>Comments: " & Request.Form("Comments") _
&"</body></html>"

'creates the email using the oMail object and the string strEmailBody
oMail.To = "
your.name@nau.edu"
oMail.From = "
Whatever@nau.edu"
'oMail.Bcc = " "
'oMail.Cc = " "
oMail.Subject = "CDONTS example"
oMail.BodyFormat = 0
oMail.MailFormat = 0
oMail.Body = strEmailBody
oMail.Send

'Resets the oMail object to Nothing
Set oMail = Nothing

%>

  • 2016 Users Found This Useful
Was this answer helpful?

Related Articles

HOWTO: Send a mail using CDOSYS

 <%  'Dimension variables  Dim objCDOSYSCon     'Create the e-mail server object  Set...

HOWTO: Use the Whois DLL Component

OverviewWhoisDLL is a Whois COM object that makes querying domain names a lot easier. The whois...