Back to product page
- Introduction
- License agreement
- Getting Started
- Enumerations
- Objects
- wodSmtp
- Methods
- Properties
- Authentication
- Blocking
- Certificate
- CharSet
- DNSHostname
- Hostname
- LastError
- LastErrorText
- Login
- MailFrom
- MailTo
- Message
- MyHostname
- MyIP
- Notification
- Password
- Port
- ProxyHostname
- ProxyLogin
- ProxyPassword
- ProxyPort
- ProxyType
- RequestReceipt
- RetryCount
- RetryWait
- Security
- State
- StateText
- Tag
- Timeout
- Transcript
- UseIPv6
- Version
- Events
- IwodSmtpClientNotify
- SmtpEncoder
- SmtpHdr
- SmtpHdrs
- SmtpMsg
- SmtpMsgs
- wodSmtp
- How to get support?
- Technical information
- Fast notifications interface
- Error list
Embed Method
Adds new embedded image to the message.
Type
A String value. CID that should be referenced from HTML part, usually in <IMG SRC=...> tag.Syntax
- Basic
object.Embed (Filename, ContentType, Encoding)
The Embed(object,Filename,ContentType,Encoding) syntax has these parts:
The Embed(object,Filename,ContentType,Encoding) syntax has these parts:
object | An expression evaluating to an object of type SmtpMsg |
Filename | Required. A String value. File on your disk you want to embed to the message. |
ContentType | Optional. A Variant value. Specifies Content-Type header value. |
Encoding | Optional. A Variant value. Specifies preferred encoding type (base64 is default). |
Remarks
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 = "..........."
cid = wodSmtp.Message.Embed ("myimage.gif", "image/gif")
wodSmtp.Message.HTMLText = "..........."
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.
If you wish to provide image directly from String instead of having it in local file, please check EmbedText method.