Sending ascii email using CDONT Sending HTML email using CDONT Sending attachments in email using CDONT Using CDONTS to send a simple ascii mail There is a component that is made available after the server installation of SMTP service. It is called CDONTS and it makes sending email rather easy. Considering that the SMTP service has been properly installed, it is fairly simple to use this feature. <% 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 " & vbCrLf MyBody = MyBody & "Please do visit us again" & vbCrLf MyBody = MyBody & "Always at your service" MyCDONTSMail.Body= MyBody MyCDONTSMail.Send set MyCDONTSMail=nothing %> HTML: Using CDONTS to send a HTML based email message This is a simple program and I assume that you have a hang of HTML Note : If the recepient's email does not support HTML then this would not be a very good approach. <% Dim MyCDONTSMail Dim HTML Set MyCDONTSMail = 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 & "<font size =""3"" face=""Arial"">" HTML = HTML & "Name Of Store<br>" HTML = HTML & "Incoming Customer Order<br>" HTML = HTML & "<p align = ""center"">Bla Bla Bla Bla Bla</p>" HTML = HTML & "<body>" HTML = HTML & "<html>" MyCDONTSMail.From= "myself@myplace.com" MyCDONTSMail.To="toyou@urplace.com" MyCDONTSMail.Subject="Saying Hello" MyCDONTSMail.BodyFormat=0 MyCDONTSMail.MailFormat=0 MyCDONTSMail.Body=HTML MyCDONTSMail.Send set MyCDONTSMail=nothing %> HTML: Using CDONTS to send a file attachment and have a Carbon Copy Recipient. <% Dim MyBody Dim MyCDONTSMail Set MyCDONTSMail = CreateObject("CDONTS.NewMail") MyCDONTSMail.From= "somebody@nowhere.com" MyCDONTSMail.To= "nobody@nowhere.com" MyCDONTSMail.Cc="nobody2@nowhere.com" MyCDONTSMail.Subject="This is a Test" MyCDONTSMail.AttachFile Server.MapPath("/somedirectory/myfile.txt") ' or you could specify the path exactly if you knew it like below ' MyCDONTSMail.AttachFile "C:\inetpub\wwwroot\somedirectory\myfile.txt" MyBody = "Thank you" & vbCrLf MyBody = MyBody & "Please visit us again" & vbCrLf MyBody = MyBody & "Always at your service" MyCDONTSMail.Body= MyBody MyCDONTSMail.Send set MyCDONTSMail=nothing %> HTML:
Sometimes newbies ask the same questions over and over, thus its better to have the answers ready for them