APP NEWS

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

网上很多关于JMail发送邮件的例子都没有写如何发附件,或者没有写清如何发内嵌的附件(比如把附件图片嵌入到HTML信件里面) 其实最关键的就是这句要注释掉 JMail.ContentType = text/html (为什么要发内嵌的附件图片?因为如果是img&nbsp

2015-06-28 00:000 次阅读
ASP实现邮件发送普通附件和嵌入附件
网上很多关于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:imagesemail.gif) 

只有HTML格式支持嵌入图片附件,我们采用HTML格式的邮件内容 
 As only HTML formatted emails can contain inline images 
 we use HTMLBody and appendHTML 
JMail.HTMLBody = Hi, here is a nice picture:
 
JMail.appendHTML  
JMail.appendHTML 

 good one huh? 

如果对方信箱不支持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 
%>

关键词标签:附件,普通,发送,实现

YOU MAY ALSO LIKE

更多应用推荐

浏览应用库