(我使用C#,VB.NET不)JMail的發送HTML格式的電子郵件,圖像變量未提交
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 = "<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電子郵件的唯一例子。
但是,正如你在這裏看到的,這是一個圖像文件。
我的情況是我將生成一個圖像,並直接發送它而不保存爲一個文件。
那麼爲此我可以做些什麼嗎? 我真的不想保存它,然後把它然後將其刪除.....
非常感謝
也許使用流,如下所示:[System.Drawing.Image流C#](http://stackoverflow.com/questions/1668469/system-drawing-image-to-stream-c-sharp)? – Tim
@Tim使用.NET System.NET.Mail namespce,但正如我明確指出的那樣,我正在使用jmail。 – Franva
實際上答案是使用System.Drawing.Image和System.IO - 它與電子郵件無關,只是一種獲取圖像而不在文件中的方式,除非我錯過了某些東西? – Tim