There was a problem loading the comments.

Sending mail with CDOSYS object

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
Since Windows XP, Microsoft is not including CDONTS on its operating systems. Instead it uses the new and more powerful mail component CDOSYS that was already present in Windows 2000.
It is still fairly simple to send a simple email although some more advanced functions are a bit more complex. We will show you how to send a simple email and how to add additional advanced configuration parameters.
The Object (CDO.Message) has several properties and methods that you must know:
.From E-mail address of the sender
.To E-mail address of the recipient
.CC E-mail address of the CC recipient
.Subject Subject of the message
.TextBody Body of the message in plain text
.HTMLBody Body of the message in HTML
.Send Calling this method the message is sent
The following example is the simplest email you can send.
<%
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "127.0.0.1"
.Item(sch & "smtpserverport") = 25
'.Item(sch & "smtpauthenticate") = 1 'basic (clear-text) authentication
'.Item(sch & "sendusername") ="[email protected]"
'.Item(sch & "sendpassword") ="yourpassword"
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "[email protected]"
.To = "[email protected]"
.Subject = "Test CDOSYS"
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
.HTMLBody = "email message goes here"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>

Share via

Related Articles

Copyright © 2025 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)