0

(我使用的是 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 电子邮件的唯一示例。

但正如您在此处看到的,它是一个图像文件。

我的情况是我将生成图像并直接发送而不将其保存为文件。

那么我能为此做些什么吗?我真的不想保存它然后发送它然后删除它......

非常感谢

4

2 回答 2

1

有一种方法......使用嵌入式 base64 CSS3 图像,如:

.myImage {background: url(data:image/gif;base64,R0lGODlhBgASALM...)}

并在您的 HTML 代码中将其作为 DIV 标记引用。根本不需要保存文件。

于 2012-11-27T15:05:11.440 回答
0

似乎没有其他选择,只能将其保存为文件并发送,然后将其删除....

我将把这篇文章再留几天,看看是否有可能解决这个问题。

于 2012-09-27T07:36:57.413 回答