Skip to content

[Bug] Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters #502

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

Closed
atmcq opened this issue Apr 9, 2024 · 1 comment

Comments

@atmcq
Copy link

atmcq commented Apr 9, 2024

I'm using an older version, but have recreated on 8.8.2. If an email is converted using EmailConverter.emlToEmail, and then back again using EmailConverter.emailToEML, and the email has the Cc header in all caps ("CC") then duplicate Cc / CC headers are created on the EML.

Outlook / Exchange appears to use upper case when sending mails - the RFC822 spec doesn't mention case, and the examples in the spec vary between cc, Cc and CC.

The code below shows the problem on the attached sample emails.

Path path = Paths.get("TestingCCPass.eml");
//Path path = Paths.get("TestingCCFail.eml");

contents = Files.readString(path,StandardCharsets.UTF_8);
Email t_message = EmailConverter.emlToEmail(new ByteArrayInputStream(contents.getBytes()));
System.out.println(t_message.getRecipients());			
String t_eml = EmailConverter.emailToEML(t_message);
System.out.println(t_eml);

Pass:

[Recipient{name='someone else', address='[email protected]', type=To}, Recipient{name='Another Person', address='[email protected]', type=Cc}]
Date: Tue, 9 Apr 2024 23:57:57 +0100 (BST)
From: someone [email protected]
Reply-To: someone [email protected]
To: someone else [email protected]
Cc: Another Person [email protected]
Message-ID: [email protected]
Subject: An RFC 822 formatted message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

This is the plain text body of the message. Note the blank line
between the header information and the body of the message.

Fail:

[Recipient{name='someone else', address='[email protected]', type=To}, Recipient{name='Another Person', address='[email protected]', type=Cc}]
Date: Wed, 10 Apr 2024 00:08:18 +0100 (BST)
From: someone [email protected]
Reply-To: someone [email protected]
To: someone else [email protected]
Cc: Another Person [email protected]
CC: Another Person [email protected]
Message-ID: [email protected]
Subject: An RFC 822 formatted message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

This is the plain text body of the message. Note the blank line
between the header information and the body of the message.

TestingSamples.zip

@bbottema bbottema added this to the 8.9.0 milestone Apr 13, 2024
@bbottema bbottema changed the title Case change to Cc field causes duplication in EmailConverter.emailToEML Message headers not treated with case insensitivity as per RFC, causing deviating headers to bubble through in Email instances, which should have been filtered out Apr 13, 2024
@bbottema bbottema changed the title Message headers not treated with case insensitivity as per RFC, causing deviating headers to bubble through in Email instances, which should have been filtered out Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters Apr 13, 2024
@bbottema bbottema changed the title Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters [Bug]: Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters Apr 13, 2024
@bbottema bbottema changed the title [Bug]: Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters [Bug] Message headers not treated with case insensitivity as per RFC, causing deviating headers to slip through the filters Apr 13, 2024
@bbottema
Copy link
Owner

Fix released in 8.8.3. Thank you for bringing this to my attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants