Using the CDONTS component to send email from ASP pages.
With the arrival of IIS4 and the SMTP service of Option Pack 4 it is now fairly easy to send email from Active Server Pages.
The following three examples should give you the basic idea and get you started.
Using CDONTS to send a text based email message.
<%
Dim MyBody
Dim MyCDONTSMail
%>
<%
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "somebody@nowhere.com"
MyCDONTSMail.To= "nobody@nowhere.com"
MyCDONTSMail.Subject="This is a Test"
MyBody = "Thank you for ordering that stuff" & vbCrLf
MyBody = MyBody & "We appreciate your business" & vbCrLf
MyBody = MyBody & "Your stuff will arrive within 7 business days"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>
Using CDONTS to send a HTML based email message.
You'll get the general idea..notice how you have to add extra double quotes inside the HTML. You can use any valid HTML. Just make sure you link the images back to your webserver so that the recipient doesn't get a broken image. If the recipient's email program doesn't support HTML this is not always a good way to send email, but most do in my experience and if they don't they will still get the message... it will just look kinda strange.
<%
Dim MyCDONTSMail2
Dim HTML
Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Sending CDONTS Email Using HTML</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""FFFFFF"">"
HTML = HTML & "<p><font size =""3"" face=""Arial""><strong>"
HTML = HTML & "Name Of Store</strong><br>"
HTML = HTML & "Incoming Customer Order</strong></p>"
HTML = HTML & "<p align = ""center"">Bla Bla Bla Bla Bla</p>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
MyCDONTSMail2.From= "somebody@somewhere.com"
MyCDONTSMail2.To="nobody@somewhere.com"
MyCDONTSMail2.Subject="Incoming Customer Order"
MyCDONTSMail2.BodyFormat=0
MyCDONTSMail2.MailFormat=0
MyCDONTSMail2.Body=HTML
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing
%>