Send Mail Using CDO for Windows – Script example for CDO

Send Mail Using CDO

On Windows server, you can send mail using CDO. CDO allows to send email using SMTP authentication as well as without SMTP authentication.

Here is the sample code to send email using SMTP authentication using CDO:

Set objEmail = CreateObject("CDO.Message")
objEmail.From = ""
objEmail.To = ""
objEmail.Subject = "Test Mail"
objEmail.Textbody = "Test Mail"
objEmail.Configuration.Fields.Item ("") = 2
objEmail.Configuration.Fields.Item ("") = "SMTP SERVER NAME"
objEmail.Configuration.Fields.Item ("") = 25
objEmail.Configuration.Fields.Item ("") = "1"
objEmail.Configuration.Fields.Item ("") = ""
objEmail.Configuration.Fields.Item ("") = "Email_Account_Password"
If Not err.number=0 Then
    Response.write "ERROR: " & err.Description
    Response.write "Email sent to " & objEmail.To
end if

You will have to update SMTP server, SMTP username and password in the above sample script.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top