CURLSMBS: Send EmailMessage with non ASCII characters

If i send Emails with CURLSMBS from @Christian Schmitz , created from the source of an EmailMessage object, i get complaints from many receipients that they see strange symbols in my Mails.

Betreff is a TextField
Nachricht is a Formatted Text Control by BKeeney
UploadData is a String
Anhaenge is an EmailAttachement object

[code] Dim em as new EmailMessage
Dim BodyText As String
BodyText = Nachricht.Text

em.AddRecipient OptionMailRecipient

em.Headers.AppendHeader “Mime-Version”, “1.0”
em.Headers.AppendHeader “Content-type”, “text/html; charset=utf-8”
em.Headers.AppendHeader “Content-Transfer-Encoding”, “8bit”
em.Headers.AppendHeader “Content-Language”, “de-DE”
em.Headers.AppendHeader “X-Mailer”, "myMailer " + App.ShortVersion // Changed for the Forum
em.Headers.AppendHeader “Reply-To”, “my@mail.xyz” // Changed for the Forum
em.Headers.AppendHeader “Message-ID”, “<” + mail_MessageID + “@maol.xyz> // Changed for the Forum”

em.Subject = EncodingToISO8859MBS(Betreff.Text).DefineEncoding(Encodings.ASCII)
em.BodyPlainText = Nachricht.Text.ConvertEncoding(Encodings.ASCII) // <- This part seems to cause issues?
em.BodyHTML = Nachricht.HTMLOutput // <- This Part seems to be fine

em.Attachments = Anhaenge

UploadData = em.source.DefineEncoding(Encodings.ASCII)[/code]

I tried so many Encoding/Decoding steps, but failed so far :frowning:

Encodings.ASCII strips all accented characters, so it should not show “strange symbols” at all.

It would help if you could get a screen capture of the characters in question so you can see what they look like.

Since German, like French, makes use of accented characters, I would be inclined to suspect an incorrect HTML encoding, or a bad decoding from the mail client. In particular, I have observed that sometimes the wrong Unicode is use for accented characters, leading to an incorrect reception on Mac. Or the other way around. I believe it may have to do with an incorrect coding of the Unicode value https://en.wikipedia.org/wiki/Unicode_and_HTML

For instance, “” will render correctly as ISO-8859-1 if coded (Windows CP-1252) but it will show as if coded (MacRoman). I see that regularly.

maybe build emails with CURLEmailMBS class instead of EmailMessage?
I put a lot of work into it to make standard conform emails and prefer all characters.

see
https://www.monkeybreadsoftware.net/class-curlemailmbs.shtml

The forum software interprets the HTML I placed in code :frowning:
I have to separate & and # :
é CP-1252 : & #233;
é MacRoman : & #142; → Ž

Thank you @Michel Bujardet and @Christian Schmitz
I will try Christians CURLEmailMBS solution now :slight_smile:

[quote=163906:@Michel Bujardet]Encodings.ASCII strips all accented characters, so it should not show “strange symbols” at all.

It would help if you could get a screen capture of the characters in question so you can see what they look like.

Since German, like French, makes use of accented characters, I would be inclined to suspect an incorrect HTML encoding, or a bad decoding from the mail client. In particular, I have observed that sometimes the wrong Unicode is use for accented characters, leading to an incorrect reception on Mac. Or the other way around. I believe it may have to do with an incorrect coding of the Unicode value https://en.wikipedia.org/wiki/Unicode_and_HTML

For instance, “é” will render correctly as ISO-8859-1 if coded é (Windows CP-1252) but it will show as Ž if coded Ž (MacRoman). I see that regularly.[/quote]

Thank you Michel. Plenty of valuable information here! :slight_smile:

[quote=163907:@Christian Schmitz]maybe build emails with CURLEmailMBS class instead of EmailMessage?
I put a lot of work into it to make standard conform emails and prefer all characters.

see
https://www.monkeybreadsoftware.net/class-curlemailmbs.shtml[/quote]

No more complaints from my users so far.
Thank you Christian.