kartevonmorgen / kartevonmorgen

This is the Alpha version (v0) of Karte von morgen. Please contribute to our new project in TypeScript (v1) https://github.com/kartevonmorgen/kartevonmorgenssr
https://kartevonmorgen.org
GNU Affero General Public License v3.0
60 stars 24 forks source link

Formatting in Emails is wrong #321

Closed david-ziegler closed 6 years ago

david-ziegler commented 7 years ago

formatting is wrong

david-ziegler commented 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

uklotzde commented 6 years ago

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).

uklotzde commented 6 years ago

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.

uklotzde commented 6 years ago

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!

uklotzde commented 6 years ago

E-Mails are now sent with an UTF-8 subject without extra encoding. Seems to work at least when receiving those mails on Linux.

uklotzde commented 6 years ago

test.zip

uklotzde commented 6 years ago

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.

uklotzde commented 6 years ago

Display on Windows Mobile is wrong: photo_2018-10-23_11-08-33

This does not work as expected!

uklotzde commented 6 years ago

Unfortunately missing encoding of header fields is a known and open issue: https://github.com/lettre/lettre/issues/304

david-ziegler commented 6 years ago

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".

screen shot 2018-10-23 at 11 17 15
uklotzde commented 6 years ago

E-Mails generated by the new Pull Request are now displayed correctly even on Windows Mobile: photo_2018-10-23_18-37-46

uklotzde commented 6 years ago

Fixed in openfairdb v0.3.9