Sample script for CDO email

CDO (Collaboration Data Objects) is an inbuilt ASP component used to send emails via ASP. It is widely used as a CDONTs replacement, because Microsoft discontinued the use of CDONTs on Windows 2000, Windows XP and Windows 2003 OS. CDO is the best choice to send emails from ASP based web applications, as it comes pre-installed with server OS like, Windows Server 2003, 2008 and 2012.

If you are still using CDONT component in your ASP application to send emails, you should update your code to use CDO. Below is a basic CDO script you can use to send emails. It's just a basic script, and you may have to customize it according to your requirements. You can find lots of web pages on the internet with more customizations and attributes with CDO.

<%
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "FROM_EMAIL"
objEmail.To = "TO_EMAIL"
objEmail.Subject = "Test Mail"
objEmail.Textbody = "Test Mail"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
If Not err.number=0 Then
    Response.write "ERROR: " & err.Description
    err.Clear
Else
    Response.write "Email sent to " & objEmail.To
end if
%>
If you run into any problems while using this script, you can contact AccuWebHosting support with the exact error message or URL.

Note: You should always clean your email list using email verification tool before starting an email campaign.


  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to disable Deprecated Function Notices in PHP.

PHP has deprecated some functions in latest version. If the same functions are still on your...

How to use Dundas Upload?

Dundas upload control is a flexible and reliable component allows you to accept, save, and...

How to use Dundas Chart?

How to create a Basic Pie Chart with Dundas Chart To use this control in a web site, you will...

How to create ASPNETDB database using aspnet_regsql tool?

What is ASPNETDB? Microsoft has introduced a new and powerful default database schema in...

How to use ASP Email?

ASPEmail 5.0 is an active server component for sending e-mail messages using an external SMTP...