top
Loading...
用HTML格式發送郵件
你可以通過SMTP服務或者MS Exchange發送HTML格式的郵件,但是,你需要注意的是,并不是所有的clients都可以正常顯示。在通常的情況下,CDONTS發送郵件是使用plain-text格式。在使用HTML方式的時候我們可以進行更多的設置,例如不同的字體,顏色,插入圖片等等。下面是一個例子
<%
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")

'//these are all the images that are in this message.
'//you must include them like this.
'//please note that you DO NOT have TO write the
'//entire file path in the <IMG> tag in the body after this.
'//make sure you see the image name after the path separated by a comma

objMail.AttachURL "D:imagesmyImage.gif", "myImage.gif"
objMail.AttachURL "D:imagesmyImage2.gif", "myImage2.gif"


HTML = HTML & "<HTML>"
HTML = HTML & "<HEAD>"
HTML = HTML & "<TITLE>Send Mail with HTML</TITLE>"
HTML = HTML & "</HEAD>"
HTML = HTML & "<BODY bgcolor=""lightyellow"">"
HTML = HTML & "<TABLE cellpadding=""4"">"
HTML = HTML & "<TR><TH><FONT color=""darkblue"" SIZE=""4"">"
HTML = HTML & now() & " - "
HTML = HTML & "These are all great ASP Sites</FONT></TH></TR>"
HTML = HTML & "<TR><TD>"
HTML = HTML & "<A HREF=""http://www.4guysfromrolla.com"">"
HTML = HTML & "<IMG SRC=""myImage.gif""></A><BR><BR>"
HTML = HTML & "<A HREF=""http://www.4guysfromrolla.com"">"
HTML = HTML & "<IMG SRC=""myImage2.gif""></A><BR><BR>"
HTML = HTML & "</FONT></TD></TR></TABLE><BR><BR>"
HTML = HTML & "</BODY>"
HTML = HTML & "</HTML>"

objMail.From = "rob@tconsult.com"
objMail.Subject = "Your daily HTML Mail"

'you need TO add these lines FOR the mail
'to be sent in HTML format
objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = "you@yourhouse.com
objMail.Body = HTML
objMail.Send

Response.write("Mail was Sent")
set objMail = nothing
%>


北斗有巢氏 有巢氏北斗