Embedding images to the message is very similar to adding
attachments - except header values describing that attachments are
slightly different. Each embedded image has corresponding
Content-ID value
that you reference from the message body later on.
Please note that wodSmtp may do significant changes on
your message if you use this method. First, it has to
determine if message is already multipart (which is needed
to have embedded images). If not, it will create appropriate
headers (by default this will be 'Content-type: multipart/related'),
choose boundary to use for parts separation, create new
message part, and add encoded image to the
message.
Using this scenario, it's easy for you to embed image to the
message, with a simple snippet like this:
Dim cid as String
cid = wodSmtp.Message.Embed ("myimage.gif", "image/gif")
wodSmtp.Message.HTMLText =
"<HTML>.......<img src=""" & cid & """>....</HTML>"
What happens to the message file after Embed is called?
wodSmtp creates temporary file, adds one header
'Content-ID', and return it's value. You
can use that value in HTML body for <IMG SRC=...> tag.
Make sure you set ContentType
argument properly, otherwise image will not be displayed correctly.
For GIF images, you should set image/gif,
and for JPEG images you should set image/jpeg.