Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.2 Online Documentation (MoTW) Revision 3

EM_ADD_ATTACHMENT Function (DataBasic Email API) (em_add_attachment.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

EM_ADD_ATTACHMENT Function

Purpose

Adds an attachment to the email from the supplied content. The size of the attachment is limited by the size of the memory available to the user.

Returns TRUE or FALSE.

Syntax

EM_ADD_ATTACHMENT(content, filename-data, attachment-type)

Syntax elements

contentThe data to be attached as a file or an in-line attachment. It can contain either ASCII or binary data.

filename-dataA dynamic array defining the details of the filename to use for the attachment.

Attribute

Name

Description

1

FILENAME

The name to be given to the file as it appears attached to or embedded in the email.

2

ALT TEXT

This contains the text to be used if the content cannot be displayed.

3

MIME TYPE

An optional mime type to use in place of the one that could be derived from the file name extension.

attachment-typeFlag to indicate the type of attachment. This can be one of two values:

Returns

EM_ADD_ATTACHMENT returns TRUE if successful or FALSE if unsuccessful.

If FALSE, the details of the failure to using the configuration can be found by inspecting the error number held in the common variable EM_ERROR_DETAILS.

If TRUE, and the attachment is to be included in-line, the named common EM_COMMON variable EM_LINK_DATA contains a formatted HTML <img> tag to represent this attachment. This is structured as:

<img src="cid:identifier" alt="alternative text" />

where identifier is a random string used to identify the attachment and alternative text is the text to displayed if the image cannot be shown in the client. The programmer must add this link to the body of email where appropriate. The next call to EM_ADD_ATTACHMENT will result in EM_LINK_DATA being overwritten so the programmer must use the original value or save it before calling EM_ADD_ATTACHMENT again.

Comments

You must include the item #EM_INCLUDES in all programs that use the Email API functions; for example, you could add the line

INCLUDE #EM_INCLUDES FROM /SYSFILES/SYS.BASLIB

at the start of the program, or create an item to be automatically included that contains this line.

RealityV15.2Revision 3Comment on this topic