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

Parser issues on "From" #3

Open
jschoch opened this issue May 10, 2016 · 4 comments
Open

Parser issues on "From" #3

jschoch opened this issue May 10, 2016 · 4 comments
Labels

Comments

@jschoch
Copy link

jschoch commented May 10, 2016

Great library btw!!!!

The following is parsed incorrectly

X-Mailer: MIME::Lite 3.028 (F2.82; T1.31; A2.08; B3.13; Q3.13)
From: "craigslist - automated message, do not reply" <[email protected]>
To: [email protected]
Subject: craigslist.org:

here is the resulting parsed terms

[%MimeMail.Address{address: "\"craigslist - automated message", name: nil}, %MimeMail.Address{address: "[email protected]", name: "do not reply\""}]
@awetzel
Copy link
Collaborator

awetzel commented May 11, 2016

Ooops :) , I have a lot of work this week, so unfortunatly I will only fix this next week.

@heri16
Copy link
Contributor

heri16 commented Jul 20, 2016

Hi @jschoch , are you still interested in getting this fixed?

@jschoch
Copy link
Author

jschoch commented Jul 21, 2016

Yup!

@jschoch
Copy link
Author

jschoch commented Jan 21, 2017

Wow, who knew parsing email was such a kludge. I spent a ton of time reading the RFC's and trying different approaches.

The problem is when the from header has something like "hello there, i'm cool" <[email protected]> the headers get split via

https://github.com/awetzel/mailibex/blob/89321330b4e46c58938182a63d047dad95b2c15d/lib/mimemail_headers.ex#L20

that should be

data |> String.strip |> String.split(~r/(,)(?=(?:[^"]|"[^"]*")*$)/) |> Enum.map(&MimeMail.Address.decode/1)

This allows for the very oddball multiple from which the RFC's allow.

Wondering if someone can take a look and see if this works. It may be good to only do this with the From: header

@marysaka marysaka added the bug label May 23, 2017
@marysaka marysaka changed the title from parse problem Parser issues on "From" May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants