(我使用的是C#,而不是VB.NET)
Set jmail = Server.CreateObject("JMail.Message")
jmail.AddRecipient "myRecipient@hisdomain.com", "Mr.Example"
jmail.From = "me@mydomain.com"
jmail.Subject = "Here's some graphics!"
jmail.Body = "A nice picture if you can read HTML-mail."
' The return value of AddAttachment is used as a
' reference to the image in the HTMLBody.
contentId = jmail.AddAttachment("c:\myCoolPicture.gif")
' 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>"
' But as not all mailreaders are capable of showing HTML emails
' we will also add a standard text body
jmail.Body = "Too bad you can't read HTML-mail."
jmail.appendText " There would have been a nice picture for you"
jmail.Send( "mailserver.mydomain.com" )这是我能找到的唯一一个通过jmail发送html电子邮件的例子。
但正如你在这里看到的,它是一个图像文件。
我的情况是,我将生成一个图像并将其直接发送,而不将其保存为文件。
那么,有什么我可以为此做的吗?我真的不想保存它,然后发送它,然后删除它.
非常感谢
发布于 2012-11-27 23:05:11
有个办法..。使用嵌入式base64 CSS3图像,如:
.myImage {background: url(data:image/gif;base64,R0lGODlhBgASALM...)}并在HTML代码中将其作为DIV标记引用。根本不需要保存任何文件。
发布于 2012-09-27 15:36:57
似乎别无选择,只能将其保存为文件并发送,然后删除它……
我将把这篇文章再放几天,看看是否有可能解决这个问题的办法。
https://stackoverflow.com/questions/12594262
复制相似问题