Skip to content

Commit 43b1f4b

Browse files
romsahelandrewtimberlake
authored andcommitted
failure to parse recipient value when the name is an e-mail address containing additional quotes
Found in production, an e-mail has the 'from' field with the following value: ```ex ""[email protected]" " <[email protected]> ```` which is incorrectly parsed into `[email protected]\"` instead of ```ex {"\"[email protected]\"", "[email protected]"} ````
1 parent 11fb848 commit 43b1f4b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/mail/parsers/rfc_2822_test.exs

+13
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,19 @@ defmodule Mail.Parsers.RFC2822Test do
570570
assert message.headers["from"] == {"Lastname, First Names", "[email protected]"}
571571
end
572572

573+
test "address name is an e-mail address with additiongal quotes" do
574+
message =
575+
parse_email("""
576+
To: "User, Test" <[email protected]>
577+
578+
Date: Fri, 1 Jan 2016 00:00:00 +0000
579+
Subject: Blank body
580+
581+
""")
582+
583+
assert message.headers["from"] == {"\"[email protected]\"", "[email protected]"}
584+
end
585+
573586
# See https://tools.ietf.org/html/rfc2047
574587
test "parses headers with encoded word syntax" do
575588
message =

0 commit comments

Comments
 (0)