Closed david-ziegler closed 6 years ago
Falsch formattierte Email: =?UTF-8?Q?Karte von Morgen - neuer Eintrag_ Teikei Gemeinschaft Reyerhof Solawi Stutt=.eml.zip Richtig formattierte Email: Karte von Morgen - neuer Eintrag_ SoLaWiS Verteilpunkt.eml.zip
Cause: Additional line break in the subject that starts with '=' in the ending line:
Subject:=?UTF-8?Q?Karte von Morgen - neuer Eintrag: Teikei Gemeinschaft Reyerhof Solawi Stutt=
gart?=
The e-mail client only display the first line in verbatim and ignores the charset, the encoding, and the remaining content from following line(s).
According to RFC 2047 "each 'encoded-word' must be self-contained", i.e. continuations on following lines must start a new encoded-word!
Correct example:
Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
This is rule is not respected by the _quotedprintable library when inserting line breaks.
The created e-mails contain UTF-8 characters in header fields. I assumme that this library internally uses the SMTPUTF8 protocol for sending e-mails, which supports UTF-8 characters. This assumption should be tested!
E-Mails are now sent with an UTF-8 subject without extra encoding. Seems to work at least when receiving those mails on Linux.
Thunderbird correctly encodes the subject of e-mails according to RFC 2047 on multiple lines:
Subject: =?UTF-8?Q?Eine_E-Mail_mit_=c3=bcberlangem_Subject_und_Umlauten_?=
=?UTF-8?B?w6TDtsO8w4TDlsOcw58gaW0gVGl0ZWwsIGRpZSBlaWdlbnRsaWNoIHNlcGFyYXQg?=
=?UTF-8?Q?enkodiert_werden_sollten?=
The lettre crate simply uses UTF-8 for this purpose. It is unknown if this works correctly for all receivers.
Display on Windows Mobile is wrong:
This does not work as expected!
Unfortunately missing encoding of header fields is a known and open issue: https://github.com/lettre/lettre/issues/304
On macOS and Mac Mail as email client the subject of the above email with Umlauts is shown correctly but the sender-name is ">". Before, the sender-name was "Karte von morgen".
E-Mails generated by the new Pull Request are now displayed correctly even on Windows Mobile:
Fixed in openfairdb v0.3.9
formatting is wrong