KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4DIC Lets You Send Messages Encoded In UTF-8
PRODUCT: 4D Internet Commands | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: November 3, 2008

4D Internet Commands now includes an option to send messages using the UTF-8 character set. To accomplish this, new selectors are available for the SMTP_SetPrefs command.

SMTP_SetPrefs (lineFeed; bodyType; lineLength) -> Integer

The SMTP_SetPrefs command now allows messages to be sent using the UTF-8 character set. Two new sets associating a character set (Body- Content-Type) with a type of encoding (Content-Transfer Encoding) can be passed in the bodyType parameter:

15: UTF-8 & quoted-printable
16: UTF-8 & base64

The SMTP_GetPrefs command also handles these types.

The following code will send a message in UTF-8 encoded in quoted-printable:

C_TEXT($Host;$FromAddress;$ToAddress;$Subject;$Message)

$err:=SMTP_SetPrefs(-1;15;-1)

$Host:="www.4d.com"
$ToAddress:="john.doe@company.com"
$FromAddress:="TSTM@4d.com"
$Subject:="UTF-8"
$Message:="New 4D Internet Commands Option"
$Error:=SMTP_QuickSend ($Host;$FromAddress;$ToAddress;$Subject;$Message)