web 2.0

How to use ASP & Sending Mail with CDONTS.NewMail (Attachment file)

How to use ASP & Sending Mail with CDONTS.NewMail (Attachment file) This is learn/tutorial asp developers how to using ASP script Sending Mail with CDONTS.NewMail (Attachment file)

ShotDev Focus:
- ASP & Sending Mail with CDONTS.NewMail (Attachment file)

Example

asp_cdo_attachment.asp


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim myMail,HTML,strMsg

Set myMail = Server.CreateObject("CDONTS.NewMail")

strMsg = ""
strMsg = strMsg &"<h1>My Message</h1><br>"
strMsg = strMsg &"<table width='285' border='1'>"
strMsg = strMsg &"  <tr>"
strMsg = strMsg &"    <td><div align='center'><strong>My Message </strong></div></td>"
strMsg = strMsg &"    <td><div align='center'><font color='red'>My Message</font></div></td>"
strMsg = strMsg &"    <td><div align='center'><font size='2'>My Message</font></div></td>"
strMsg = strMsg &"  </tr>"
strMsg = strMsg &"  <tr>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"  </tr>"
strMsg = strMsg &"  <tr>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"    <td><div align='center'>My Message</div></td>"
strMsg = strMsg &"  </tr>"
strMsg = strMsg &"</table>"

myMail.AttachFile(Server.MapPath("MyFiles/shotdev1.txt"))
myMail.AttachFile(Server.MapPath("MyFiles/shotdev2.txt"))

myMail.From = "Webmaster <webmaster@shotdev.com>"
myMail.Value("Reply-To") = "reply@shotdev.com"
myMail.To   = "member@shotdev.com"
myMail.Cc   = "Mr.Surachai Sirisart<member@shotdev.com>"
myMail.Bcc   = "webmaster@shotdev.com"
myMail.Subject = "My Subject"
myMail.MailFormat = 0
myMail.Importance = 2 '*** 0=Low,Priority,1=Normal,2=Hight ***'
myMail.BodyFormat = 0
myMail.Body = strMsg

myMail.Send

Response.write ("Mail Sending.")
Set myMail = Nothing
%>
</body>
</html>

Create a asp file and save to path root-path/myasp/

Run
http://localhost/myasp/asp_cdo_attachment.asp

Screenshot

ASP & Sending Mail with CDONTS.NewMail (Attachment file)
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.