Question

(I'm using C#, not 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" )

This is the only example I can find to send a html email via jmail.

But as you can see here, it's a image file.

My case is I will generate a image and send it directly without saving it as a file.

So are there anything I can do for this purpose? I really don't want to save it and then send it then delete it.....

Many thanks

Was it helpful?

Solution

There is a way... use embedded base64 CSS3 images like :

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

And reference this in your HTML code as a DIV tag. No file needs to be saved at all.

OTHER TIPS

It seems that there is no other option but to save it as a file and send it, then delete it....

I'll leave this post for another a few days to see whether there are possible workaround for this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top