Asp编程

ASP实现邮件发送普通附件和嵌入附件

日期:2015/6/28来源: IT猫扑网

网上很多关于JMail发送邮件的例子都没有写如何发附件,或者没有写清如何发内嵌的附件(比如把附件图片嵌入到HTML信件里面) 

其实最关键的就是这句要注释掉 

JMail.ContentType = text/html 

(为什么要发内嵌的附件图片?因为如果是img src=/uploads/allimg/080527/2317420.jpg)) 
增加一个嵌入式附件 
 The return value of AddAttachment is used as a 
 reference to the image in the HTMLBody. 
contentId = JMail.AddAttachment(Server.MapPath(images/email.gif)) 
Dim contentId 
contentId = JMail.AddAttachment(E:\images\email.gif) 

只有HTML格式支持嵌入图片附件,我们采用HTML格式的邮件内容 
 As only HTML formatted emails can contain inline images 
 we use HTMLBody and appendHTML 
JMail.HTMLBody = <html><body><font color=red>Hi, here is a nice picture:</font><br> 
JMail.appendHTML <img src=cid: & contentId & > 
JMail.appendHTML <br><br> good one huh?</body></html> 

如果对方信箱不支持HTML格式邮件,我们仍需要给他一个友善的提示 
 But as not all mailreaders are capable of showing HTML emails 
 we will also add a standard text body 
JMail.Body = Too bad you cant read HTML-mail. 
JMail.appendText  There would have been a nice picture for you 

JMail.Send( mail.skyhe.com ) 
JMail.Close() 
Set JMail = Nothing 
%>

相关文章

相关下载

网友评论

我要评论...
    没有更早的评论了
    取消