-
Notifications
You must be signed in to change notification settings - Fork 67
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
7bit encoded email with line break #151
Comments
Is @andrewtimberlake 's answer in #138 not sufficient? |
I agree with Andrew's RFC understanding but the direct conclusion is that we can't send multi-line emails with this encoding. That can't be possible, I must be missing something. May I add that python |
@htulipe so your issue is not with the parsing but the compilation from the data structure into an email? |
My goal is to read an EML file and transform it in some data structure that my frontend end can then display. |
First of all, thank you for your work on this module. However, I have the following question... What should be the expected parsed message IO.inspect(
Mail.parse([
"From: a@b.tld",
"To: c@d.tld",
"Subject: test",
"Content-Transfer-Encoding: 7bit", # or 8bit
"",
"line1",
"line2"
])
) Option A:
Option B:
I personally lean towards Option A, but the |
I subsequently found out that 7bit decoding was removing line breaks indiscriminately and should only be removing those used to wrap lines exceeding the maximum length of 1000 chars |
Thank you for the quick fix. I think the same problem effects the IO.inspect(
Mail.parse([
"From: a@b.tld",
"To: c@d.tld",
"Subject: test",
"Content-Type: text/plain; charset=UTF-8",
"Content-Transfer-Encoding: 8bit",
"",
"lïne1",
"lïne2"
])
) outputs this:
no |
Thanks, great catch. Fixed in #166 |
Hello. Maybe a dumb question but I can't see how the lib can successfully parse a 7bit encoded email that contain line breaks. By successfully I mean without losing line breaks.
Version
mail 0.2.3
Erlang/OTP 24 [erts-12.3.2.6] [source] [64-bit] [smp:5:5] [ds:5:5:10] [async-threads:1]
Elixir 1.14.0 (compiled with Erlang/OTP 24)
Test Case
Using the parse_email function defined in parser test:
Steps to reproduce
Run the above code
Expected Behavior
The returned body should have some sort of line breaks:
This is the body!\nIt has more than one line
Actual Behavior
The returned body no longer have line breaks:
This is the body!It has more than one line
Reading at the code, I see that the lib joins the body lines using
\r\n
but the SevenBit parser called just after drops them. Am I missing something ?Joining the body lines with
\n
instead of\r\n
seems to fix the issue.Thanks in advance
PS: I saw the previous issue on the matter but could not find an answer there so I allowed myself to repost a new issue.
The text was updated successfully, but these errors were encountered: