[
https://issues.apache.org/jira/browse/EMAIL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13787617#comment-13787617
]
Thomas Neidhart commented on EMAIL-133:
---------------------------------------
This is a very problem specific solution and may not be what other users expect.
In fact it depends on the email client used which filename will be set for the
inner email message.
E.g. when doing the same with thunderbird, the filename will be set
automatically to "Attached message".
> 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.
> Attachments: Parent EMail.msg
>
>
> 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 was sent by Atlassian JIRA
(v6.1#6144)