Legacy charset support with 4D email

Automatically translated from English

If you still need to communicate with old devices that don’t support Unicode, this blog post is for you! Keep reading because with 4D v17 R5, you can send emails in legacy encodings (ISO-2022-JP for Japanese or ISO-8859-1 for Western European).

The SMTP New transporter command accepts new parameters so you can specify the type of encoding to use in the header or body. For example, if you want to send an email in Japanese and use the ISO-2022-JP encoding, simply write:

$smtp:=New object
// Define the type of encoding to use in your body parts
$smtp.bodyCharset:=mail mode ISO2022JP
// Define the type of encoding to use in your mail header
$smtp.headerCharset:=mail mode ISO2022JP
$smtpTransporter:=SMTP New transporter($smtp)
$email.from:="アリス <alice@mail.com>"
$email.to:="八郎 <hachiro@mail.com>"
$email.textBody:="4D v17 R4 以降、新しい方法でeメールの作成と送信ができるようになりました。"

4D uses the ISO-2022-JP charset when it converts your mail to MIME:

MIME-Version: 1.0
Date: Wed, 13 Mar 2019 15:32:16 GMT
Message-ID: <843E4861CC54404F8597E65974A4832D>
Sender: =?ISO-2022-JP?Q?=1B$B%"%j%9=1B=28B?= <alice@mail.com>
From: =?ISO-2022-JP?Q?=1B$B%"%j%9=1B=28B?= <alice@mail.com>
To: =?ISO-2022-JP?Q?=1B$BH=2CO=3A=1B=28B?= <hachiro@mail.com>
Subject: =?ISO-2022-JP?Q?=1B$B%a!<%k$NAw?.=1B(B?=
Content-Type: text/plain; charset="ISO-2022-JP"
Content-Transfer-Encoding: 7bit
4D v17 R4 $B0J9_!"?7$7$$J}K!$G(Be$B%a!<%k$N:n@.$HAw?.$,$G$-$k$h$&$K$J$j$^$7$?!#(B

More details can be found on the doc center.

Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.