Aspose Team,
We use the Aspose Email java package to get properties from msg files. Some msg and eml files have two CC entries like the following
From: sender@example.com
To: recipient@example.com
CC: cc1@example.com
Cc: cc2@example.com
Subject: Test Email with Duplicate CC Headers
Date: Fri, 11 Jul 2025 17:15:32 +0530
However, Aspose only gets one of them (the last one). Note that both values show up when the files are opened with Outlook.
Wonder if you can give us some advice about getting all the values.
By the way, our client found two To entries in some of the files. Wonder if Aspose has the same issue in this case.
Following is the sample code and attached are two sample files. The operating system is Ubuntu 20.04. Java version is 21. Aspose Email java packages is 25.6.
Sample code:
import com.aspose.email.MailMessage;
public class GetCC_34 {
public static void main(String[] args) {
String inputMsg = “my_path/sample_email_1.msg”;
String inputEml = “my_path/eml_file.eml”;
try {
new com.aspose.email.License().setLicense(“my_path/Aspose.Total.Java.lic”);
The issue you’re experiencing with Aspose.Email only extracting one CC entry from emails that contain multiple CC entries is likely due to how the library processes the headers. In some cases, it may only recognize the last occurrence of a header, which can lead to missing earlier entries.
Solution
To ensure that all CC entries are extracted, you can manually parse the headers of the email message. This way, you can retrieve all instances of the CC field, regardless of how many there are.
Code
Here’s a modified version of your code that demonstrates how to extract all CC entries by directly accessing the headers:
This suggestion does not help. This issue is for when there are 2 (or maybe more) CC / To / BCC fields in the file with 1 or more entries in each line.
Aspose.Email follows the standards (RFC 5322) when parsing email files. According to these standards, each recipient header such as To, CC, or BCC should appear only once in the email headers. If multiple recipients are needed, they should be combined into a single header field, with addresses separated by commas.
Correct Format:
CC: cc1@example.com, cc2@example.com
To: to1@example.com, to2@example.com
Incorrect Format:
CC: cc1@example.com
Cc: cc2@example.com
To: to1@example.com
To: to2@example.com