You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Olaf K. (JIRA)" <ji...@apache.org> on 2013/09/23 16:46:03 UTC

[jira] [Created] (EMAIL-133) Problem reading datasource name of inner email-message

Olaf K. created EMAIL-133:
-----------------------------

             Summary: Problem reading datasource name of inner email-message
                 Key: EMAIL-133
                 URL: https://issues.apache.org/jira/browse/EMAIL-133
             Project: Commons Email
          Issue Type: Bug
    Affects Versions: 1.3.1
         Environment: Outlook 2007, James 3.0 beta4
            Reporter: Olaf K.


Situation:
- Create EMail in Outlook and attach an other EMail (via Drag&Drop)
  e.g parent email subject: "Parent EMail", inner email subject: "Inner Email" 
- after parsing this email I try to acces the attachmentname, but the result is a null-value. I acpected "Inner Email" as the attachmentname.

{code}
mimeMessageParser.parse();
List<DataSource> attachAsDataSource = mimeMessageParser.getAttachmentList();

for (DataSource dataSource : attachAsDataSource) {
  String filename = dataSource.getName();
  // filename == null
{code}

To resolve this behavior I patched the Methode "getDataSourceName" in "MimeMessageParser" as follows.
{code}
..
if ("message/rfc822".equalsIgnoreCase(contentType)) {
  result = ((Message) part.getContent()).getSubject();
  // START: Optional
  if (StringUtils.isNotBlank(result)) {
	// Add eml-prefix, because binary data is in eml-format and I can use OUTLOOK.EXE /eml "filename"
	result += ".eml";
  } else {
	result = "unknown.eml";
  }
  // END: Optional
}
...
{code}

Now the inner email is recognized as an email-message and the subject is used for the name.

Is there an other way to receive the subject as the attachment-name (without patching)?



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira