Set jmail = Server.CreateObject("JMail.Message")
jmail.AddRecipient "[email protected]", "Mr.Example"
jmail.From = "[email protected]"
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 = "
Hi, here is a nice picture:"
jmail.appendHTML ""
jmail.appendHTML "
good one huh?"
' 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-09-26
Franva
+0
也许使用流,如下所示:[System.Drawing.Image流C#](http://stackoverflow.com/questions/1668469/system-drawing-image-to-stream-c-sharp)? –
+0
@Tim使用.NET System.NET.Mail namespce,但正如我明确指出的那样,我正在使用jmail。 –
+0
实际上答案是使用System.Drawing.Image和System.IO - 它与电子邮件无关,只是一种获取图像而不在文件中的方式,除非我错过了某些东西? –