Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some brittleness parsing basic headers #9

Open
mmirate opened this issue Jan 9, 2021 · 1 comment · May be fixed by #13
Open

Some brittleness parsing basic headers #9

mmirate opened this issue Jan 9, 2021 · 1 comment · May be fixed by #13

Comments

@mmirate
Copy link

mmirate commented Jan 9, 2021

When sending a sample of my inbox (selected via an IMAP fetch of "BODY.PEEK[HEADER.FIELDS (MESSAGE-ID DATE SUBJECT FROM)]") through this library, it fails to parse some entries. Exemplars:

"Subject: A message to the campus community\r\nDate: Tue, 27 Nov 2018 16:33:37 +0000\r\nFrom: [email protected],\r\n\tG.P.“[email protected],\r\n\t\" Peterson <[email protected]>\"@list7.ecc.gatech.edu\r\nMessage-id: <git-all.18@anonymous>\r\n\r\n" => Err(TagError("\r\n",))
"Subject: Remembering Kevin Chang and Carter Johns\r\nDate: Thu, 29 Nov 2018 20:17:59 +0000\r\nFrom: John M. Stein <[email protected]>\r\nMessage-id: <git-all2.6@anonymous>\r\n\r\n" => Err(MissingHeader("From",))
"Date: Wed, 25 Sep 2019 18:31:08 GMT\r\nMessage-Id: <[email protected]>\r\nFrom: \"Uptime Robot\" <[email protected]>\r\nSubject: Introducing Two-Factor Authentication (2FA)\r\n\r\n" => Err(MissingHeader("Date",))
"Subject: Graduate voices in 2021\r\nFrom: \"IB Alumni Network\" <[email protected]> \r\nDate: Sun, 06 Dec 2020 02:00:43 +1100\r\nMessage-ID: <[email protected]>\r\n\r\n" => MissingHeader("From",)
@Mubelotix
Copy link
Owner

Mubelotix commented Jan 9, 2021

I will investigate these errors. The last 3 seems to be caused by a wrong syntax (actually it's because you cannot construct an Email struct with undefined headers but I will add an easy way to parse incomplete data). The first one is more mysterious. Error handling is hard with this library because there is no way to know where is the error in the email. I tried to add more information in an Error struct but performances dropped significantly. Maybe I will add this behind a feature gate.

@Mubelotix Mubelotix linked a pull request Apr 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants