-
-
Notifications
You must be signed in to change notification settings - Fork 274
Description
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-printableThis 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-printableThis is the plain text body of the message. Note the blank line
between the header information and the body of the message.