ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.11k stars 145 forks source link

Failed to parse addresses prevents importing of emails #451

Closed yu-tendo closed 6 months ago

yu-tendo commented 6 months ago

Description of the problem

The email cannot be imported with the Proton Mail Bridge due to a parsing error of the address fields. When moving the message (with Thunderbird), one of the following error messages is printed:

  1. failed to retrieve addresses from literal:failed to parse addresses for 'To': [Error offset=8197]: expected ':' for group start: known recovered message, possible duplication. (see attached example, issue-1.txt)
  2. failed to retreive addresses from literal:failed to parse addresses fo'Cc': [Error offset=98]: expected byte value 3f: known recovered message, possible duplication. (see attached example, issue-2.txt)
  3. failed to retrieve addresses from literal:failed to parse addresses for 'Cc': [Error offset=45]: expected atext char for atom: known recovered message, possible duplication. (see attached example, issue-3.txt)
  4. failed to retrieve addresses from literal:failed to parse addresses for 'To': [Error offset=45]: expected atext char for atom: known recovered message, possible duplication. (see attached example, issue-4.txt)

Comment

I am not sure if it is possible to fix these issues, as it might be the case that the e-mails are simply faulty (i.e., the respective issue cannot be corrected automatically). However, identifying manually the faulty e-Mails while actually moving thousands of e-Mails is very time-consuming. Thus, I would expect that at least the email-moving process is not interrupted and the faulty emails are skipped. Assuming the bridge cannot handle the parsing issue, I suggest that a respective FAQ entry (or similar) is created covering an explanation of the issue and how to potentially manually fix this issue (otherwise users will keep opening new issues).

Related to Issue 2: It seems to be valid to use the following format in the address field:

=?utf-8?b?U3Ryw6FuZ8OpIE7DpG3DqQ==?= \test@example.com\

It seems the bridge does not support this format (=?charset?encoding?encoded-text?=) (It is not restricted to utf-8).

Version Information

Proton Mail Bridge v3.8.1 (br-187) Thunderbird 115.6.0 (64-bit) Microsoft Windows 10

File Attachments

issue-1.txt issue-2.txt issue-3.txt issue-4.txt

LBeernaertProton commented 6 months ago

Thanks for the detailed report. We will look into the first 2 issues.

Regarding 3 & 4, it seems to be related to addr1,,addr2. Which is not a valid address list.

LBeernaertProton commented 6 months ago

Internally tracked as GODT-3179

LBeernaertProton commented 6 months ago

I have check the first 2 cases an, in order of appearance:

1) eva.boelle.@t-online.de is technically not a valid email representation. I will need to discuss with my colleagues if we want to relax the parser.

2) =?UTF-8?Q?Thorsten Kn=c3=b6ller?= is also not a valid encoding, the spec states that there can be no spaces in this encoding format.

LBeernaertProton commented 6 months ago

After discussing with my colleagues, it was agreed that at this point in time, we won't relax the parsing rules.