ASP Hosting sale!
1,000MB space, 40GB transfer, 1 SQL Server 2000 db! - $9.95 per month*!
Limited Time Offer!

aspdev | articles | tutorials | forums

ASPdev -> All Articles -> Send email from ASP with CDOSYS

Send email from ASP with CDOSYS

CDOSYS email component replaced the old Microsoft's email component CDONTS. It is recommended now to use CDOSYS instead of CDONTS when emailing from ASP.

Here is how to use CDOSYS to send email from ASP:

<%

Set oMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")

oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
oMailConfig.Fields.Update

Set oMail.Configuration = oMailConfig
oMail.From = "your-email@your-domain.com"
oMail.To = "recipient@another-domain.com"
oMail.Subject = "Here goes the email subject..."
oMail.HTMLBody = "Here goes the email body..."
oMail.Send

Set oMail = Nothing
Set oMailConfig = Nothing

%>




Contact Us