[ 
https://issues.apache.org/jira/browse/EMAIL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478821#comment-16478821
 ] 

Ankur Garg commented on EMAIL-133:
----------------------------------

[~tn] this seems to be very generic issue.

> 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.
>            Priority: Major
>         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
(v7.6.3#76005)

Reply via email to