Learn How to Send mail from Classic ASP!

Sending mail from IIS server is so easy, just we need to use the COD (Collaboration Data Objects).

Firstly, create an object from COD,

<%

Set mailfromasp = CreateObject("CDO.Message");

%>

You know what all needs to be send an email right?. Anyhow I will just remember you, we need the followings:

To:
From:
Subject:
TextBody:

These things we are using daily in our life sending emails and receiving. The same thing we are going to write as a program, have a look at the below source code:

<%

Set mailAsp = CreateObject("CDO.Message");
mailAsp.Subject="Just a test email from asp program"
mailAsp.From="yourmail@domain.com"
mailAsp.To="sendtohim@hisdomain.com"
mailAsp.TextBody="Body content testing"
mailAsp.Send
set myMail=nothing

%>

This is how we can send email from classic ASP programming. I hope this is simple and useful!

Leave a Reply

Theme: Overlay by Kaira
Agurchand