Sending e-mails using ASP and CDOSYS

Sending e-mails using ASP and CDOSYS - sample code:


<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" -->

<%
Dim ObjectSendMail
Dim Conf
Dim Fields

Set ObjectSendMail = Server.CreateObject("CDO.Message")
Set Conf = Server.CreateObject("CDO.Configuration")

Set Fields = Conf.Fields
With Fields
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "localhost"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10

.Item(cdoSMTPAuthenticate)

 = cdoBasic
.Item(cdoSendUserName) = "USERACCOUNT"
.Item(cdoSendPassword) = "PASSWORD"
.Update
End With

Set ObjectSendMail.Configuration = Conf

Set ObjectSendMail.Configuration = Conf
ObjectSendMail.Subject = "My message subject"
ObjectSendMail.From = "you@yourdomain.com"
ObjectSendMail.To = "someone@domain.com; somebody@domain.com"

ObjectSendMail.TextBody = "This is a plain text email"

ObjectSendMail.Send

Set ObjectSendMail = Nothing
Set Conf = Nothing
Set Fields = Nothing

Was this answer helpful?

 Print this Article

Also Read

How do I change the timestamp on my emails?

How do I change the timestamp on my emails? Each webmail client has a timezone setting, which is...

How to stop receiving duplicate emails from POP3 server in Outlook

Receiving redundant emails in Outlook is one the prime concern for Outlook users due to its size...

To set up Message Filters (Message Rules) in Outlook Express

<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal...

I'm getting a 'relay denied' error message when trying to send my mail.

You attempt to send mail, but receive an error message that looks like this: protocol smtp;...

Does Web Sanchar India offer any spam filtering tools?

Yes we do have installed anti-spam and anti-virus server side protection. However we recommend...