-
-
Notifications
You must be signed in to change notification settings - Fork 274
Description
When using the EmailConverter.outlookMsgToEmail method, the headers are missing in the Email object returned. Below is a sample which shows the headers are retrieved when using OutlookMessageParser's parseMsg however using the same input file with EmailConverter shows no headers are retrieved.
package com.test;
import java.io.File;
import java.io.IOException;
import org.simplejavamail.api.email.Email;
import org.simplejavamail.converter.EmailConverter;
import org.simplejavamail.outlookmessageparser.OutlookMessageParser;
public class TestEmailHeaders {
public static void main(String[] args) {
OutlookMessageParser msgp = new OutlookMessageParser();
org.simplejavamail.outlookmessageparser.model.OutlookMessage msg;
String inputFileName = "YourEmailFile.msg"; // <--- Update this with the name of an Outlook email file (.msg) on your system.
try {
msg = msgp.parseMsg(inputFileName);
System.out.println(">>> Headers from msg: " + msg.getHeaders());
Email email = EmailConverter.outlookMsgToEmail(new File(inputFileName));
System.out.println(">>> Headers from email: " + email.getHeaders());
} catch (IOException e) {
// This should never occur during this test.
e.printStackTrace();
}
}
}
In the output from the above, you will notice that the ">>> Headers from msg:" is followed by a number of headers but the ">>> Headers from email: {}" indicates that there are no headers returned from the Email's getHeaders() method.
The problem may stem from the buildEmailFromOutlookMessage method in org/simplejavamail/internal/outlooksupport/converter/OutlookEmailConverter which does not appear to copy the headers from the OutlookMessage to the Email object after converting them from a string.