Hi experts,
I use Business Central version 13 on-prem.
I have made a new codeunit that uses codeunit "SMTP Mail" to send an e-mail. It works fine (also with Danish characters in the e-mail subject and body).
But if I add an attachment (a pdf-file), the Danish characters in the e-mail subject, is shown wrongly in Outlook.
The header of the e-mail has this, when it works:
Subject: Løn: Test mail
Content-Type: text/plain; charset="utf-8"
and this, when it does not work:
Subject: Løn: Test mail
Content-Type: multipart/mixed;
boundary="--boundary_28_3eeb0768-ce3e-47ce-810a-b3510541816c"
The subject of the e-mail with the attachment is shown as "Løn: Test mail".
Here is my codeunit:
SMTP.CreateMessage('From me', 'my-email@gmail.dk', 'my-email@gmail.dk', 'Løn: Test mail', 'The body', false);
SMTP.AddAttachment('C:\\temp\\Some-real-file.pdf','The-filename-to-show-in-the-mail.pdf');
SMTP.TrySend;
If I outcomment AddAttachment, everything works fine. If I add the attachment, the DotNet "Mail" object in codeunit "SMTP Mail" forgets that it is in Denmark.
Hope you can help.
Morten