AddInlineFromFile

Insert a specified object into the message body

AddInlineFromFile (FilePath , OptionList)

Parameters

Parameter Type Direction Description
FilePath string In File name with complete path; maximum of 1024 bytes
OptionList string In Associative list of key-value pairs, to a maximum of 10240 bytes.
Options
Parameter Type
MIMEType=MimeType Set to the correct media MIME type for the attachment. If omitted, the file extension is used to determine the MIME type. If the file has an unknown extension, application/octet-stream is used.
ContentID= Specify the Content-ID header of the inline file. This enables you to embed files from different locations but with the same name.

Return Values

Values returned in $status
Value Description
0 Operation succeeded.
-13 File open error.
-14 MIME encoding failed
-18 Memory allocation error
<0 An error occurred

Description

Inline objects can only be sent if SetMessage specifies MIMEType="text/html" in the option list. If this is not the case, the AddInlineFromFile operation is ignored.

For inline objects, such as an image, the HTML content should contain a content ID (cid) reference at the position where the object occurs. The AddInlineFromFile operation enables you to specify the complete path and file name of the referenced object so that it gets sent with the message. The email client of the recipient is responsible for displaying the message and its inline object.

If the HTML message body does not contain a cid reference, the object specified with AddInlineFromFile is sent with the message. The recipient's email client determines whether it is available as an attachment or ignored.

To add multiple inline objects, call this operation for each object that needs to be added.

The following example uses the ContentID option to add image files with the same name:

variables
    handle mailApiHandle
endvariables

; create the instance handle
newinstance "UPOPMAIL", mailApiHandle

...
mailApiHandle->AddInlineFromFile("dir1/proto.jpg", "ContentID=image1")
mailApiHandle->AddInlineFromFile("dir2/proto.jpg", "ContentID=image2")