elixir-mail icon indicating copy to clipboard operation
elixir-mail copied to clipboard

CC parsing presumes the header is capitalized as "CC", though being defined as "Cc" is at least somewhat of an occurence.

Open LetThereBeDwight opened this issue 3 years ago • 0 comments

Version

0.2.3

Test Case

test "parses a multipart message" do
  message =
    parse_email("""
    To: Test User <[email protected]>, Other User <[email protected]>
    Cc: The Dude <[email protected]>, Batman <[email protected]>
    From: Me <[email protected]>
    Reply-To: OtherMe <[email protected]>
    Subject: Test email
    Mime-Version: 1.0
    Content-Type: multipart/alternative; boundary=foobar

    --foobar
    Content-Type: text/plain

    This is some text

    --foobar
    Content-Type: text/html

    <h1>This is some HTML</h1>
    --foobar--
    """)

  assert message.headers["cc"] == [
           {"The Dude", "[email protected]"},
           {"Batman", "[email protected]"}
         ]
end

This test will fail, it is a trimmed down version of the test defined at test/mail/parsers/rfc_2822_test.exs:42 - the only functional difference is that line 46 CC: The Dude <[email protected]>, Batman <[email protected]> is that the header is defined as "Cc" as opposed to "CC"

Steps to reproduce

See above and run that test - not entirely sure what the spec says about this but email from gmail routed through AWS SES -> SNS -> S3 has the header defined as Cc.

Expected Behavior

Should be able to parse the cc header properly.

Actual Behavior

Cannot properly parse cc recipients if the header is defined with "Cc"

LetThereBeDwight avatar Aug 16 '22 20:08 LetThereBeDwight