Custom headers are useful to add information that may not be supported with standard properties. In 4D v17 R5, we’re not only giving you a set of predefined headers, but also a way to declare customized headers to the mail object.
Predefined headers
Five new predefined headers are available directly with the mail object:
- messageId: Single unique message identifier referring to a particular message version.
- inReplyTo: Message identifier of the original message to which the current message is a reply
- references: Collection of message identifier(s) of other message(s) to which the current message may be related.
- keywords: Object containing important words and phrases that might be useful for the recipient.
- comments: Contains any additional comments about the text of the body or the message.
$email.messageId:="<789e48debe194aa0a0e68354005d7077@4d.com>"
$email.inReplyTo:="<b21f0c56ec634829b7a601c6dc3e3bbe@4d.com>"
$email.references:=New collection("<01a824dd8050407bacd730630348e6a4@4d.com>";"<b21f0c56ec634829b7a601c6dc3e3bbe@4d.com>")
$email.keywords:=New object("mail_4D";True)
$email.keywords["$flagged"]:=True
$email.comments:="This email is sent with the 4D's new SMTP New transporter command"
Custom headers
Need even more headers? No problem, just use the headers collection to add a specific SMTP header to your email:
$email.headers:=New collection()
$email.headers.push(New object("name";"Accept-Language";"value";"fr-FR, en-US"))
$email.headers.push(New object("name";"Importance";"value";"High"))
$email.headers.push(New object("name";"X-Custom-Header";"value";"Your value"))
Below is an example displyaing the importance and keywords headers in a mail client: