用HTML格式发送邮件
2014-04-21 15:53
351 查看
用HTML格式发送邮件
文章出处:联动天下 作者:联动天下 发布时间:2005-12-21
你可以通过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:\images\myImage.gif", "myImage.gif"
objMail.AttachURL "D:\images\myImage2.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
%>
文章出处:联动天下 作者:联动天下 发布时间:2005-12-21
你可以通过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:\images\myImage.gif", "myImage.gif"
objMail.AttachURL "D:\images\myImage2.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
%>
相关文章推荐
- php mail()方法发送html格式的邮件
- 发送邮件把图片用base64后 用html格式发送
- Java使用Velocity模板发送HTML格式邮件并解决中文乱码问题
- C#发送内置图片html格式邮件的方法
- 使用qq邮箱发送html格式的邮件
- JAVAMAIL发送邮件正文是html格式并且显示图片还带有附件的邮件
- Perl 通过SMTP发送正文为HTML格式的邮件
- 用mutt发送html格式的邮件
- [求助]如何发送HTML格式的Gmail邮件?
- spring mvc 发送html格式velocity邮件模板(包括定时发送与按钮触发发送)
- Linux自动发送HTML格式并带附件的邮件(转)
- 用Java发送HTML格式邮件测试类(支持中文)
- MAPI发送HTML格式邮件注意事项
- 用Java Mail发送带有图片附件的html格式邮件
- asp.net 发送HTML格式邮件及发送Html模版邮件
- 通过C#发送自定义的html格式邮件
- 关于ASP。NET发送HTML格式的邮件
- 使用javamail发送html格式邮件
- python HTML格式发送邮件
- python练习--发送html格式邮件且发送附件;