SetMessageId
Generates a message ID for the message being sent.
SetMessageId("
{MessageID }")
Parameters
Parameter | Type | Direction | Description |
---|---|---|---|
MessageID | string | In | User-defined message ID. Uniface does not check whether this ID is SMTP-compliant. If omitted, Uniface generates a globally unique ID that complies with rules of the SMTP protocol. |
Return Values
Value | Description |
---|---|
0 | Operation succeeded. |
-18 | Memory allocation error. |
<0 | An error occurred |
Description
Use SetMessageId before a Send operation to ensure that the message has an ID.
Message IDs are used to mark relationships between emails, such as the email that replies to or forwards another email. Some mail servers do not generate message IDs for sent emails, which can cause problems for mail clients.
The SMTP protocol specifies that message IDs must
be globally unique and have the format
<LocalId@HostDomain>
. It is common to
use a timestamp and some random characters as the LocalId.
If MessageID is omitted, Uniface generates a message ID with the following format, where X is a random alphanumeric character:
<TimeStamp.XXXXXXXXXXXXXXXX@HostName>
SetMessageId
The following example instructs Uniface to generate a message ID:
mailApiHandle->SetMessageId("")