You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Olaf Kaus <ol...@gmail.com> on 2013/09/20 19:13:23 UTC
[email] Problem reading filename from inline email
Hi,
how can I extract the filename from an included email.
If I use mimeMessageParser.getAttachmentList() and then
dataSource.getName() but I received null for attched emails.
The incoming email was created with outlook (html-email) and via
drag-n-drop I include an other email as an attachment.
To resolve this behavior I patched the Methode "getDataSourceName" in
"MimeMessageParser" as follows.
...
if ("message/rfc822".equalsIgnoreCase(contentType)) {
result = ((Message) part.getContent()).getSubject();
if (StringUtils.isNotBlank(result)) {
result += ".eml";
} else {
result = "unknown.eml";
}
...
(I stripped some null-checks)
Do you have an other solution?
Thx in advance
Olaf
Re: [email] Problem reading filename from inline email
Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Olaf,
can you create a JIRA with the attached file?
Cheers,
Siegfried Goeschl
On 20.09.13 19:13, Olaf Kaus wrote:
> Hi,
> how can I extract the filename from an included email.
> If I use mimeMessageParser.getAttachmentList() and then
> dataSource.getName() but I received null for attched emails.
>
> The incoming email was created with outlook (html-email) and via
> drag-n-drop I include an other email as an attachment.
>
> To resolve this behavior I patched the Methode "getDataSourceName" in
> "MimeMessageParser" as follows.
>
> ...
> if ("message/rfc822".equalsIgnoreCase(contentType)) {
> result = ((Message) part.getContent()).getSubject();
> if (StringUtils.isNotBlank(result)) {
> result += ".eml";
> } else {
> result = "unknown.eml";
> }
>
> ...
> (I stripped some null-checks)
>
> Do you have an other solution?
>
> Thx in advance
> Olaf
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [email] Problem reading filename from inline email
Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello Olaf,
I havent been able to reproduce your situation as Outlook does not write
.eml Files and I dont think anybody uses Outlook Express anymore. Anyway,
can you please post the Mime headers of the mail in question?
I strongly suspect there is no disposition name in there, and therefore
[email] cannot extract it. Falling back to the Subject might be an option
for your application if you want to mimic the display of OE. (You dont
need to patch the library for that, you can just do it in the app).
Bernd
Am 20.09.2013, 19:13 Uhr, schrieb Olaf Kaus <ol...@gmail.com>:
> Hi,
> how can I extract the filename from an included email.
> If I use mimeMessageParser.getAttachmentList() and then
> dataSource.getName() but I received null for attched emails.
>
> The incoming email was created with outlook (html-email) and via
> drag-n-drop I include an other email as an attachment.
>
> To resolve this behavior I patched the Methode "getDataSourceName" in
> "MimeMessageParser" as follows.
>
> ...
> if ("message/rfc822".equalsIgnoreCase(contentType)) {
> result = ((Message) part.getContent()).getSubject();
> if (StringUtils.isNotBlank(result)) {
> result += ".eml";
> } else {
> result = "unknown.eml";
> }
>
> ...
> (I stripped some null-checks)
>
> Do you have an other solution?
>
> Thx in advance
> Olaf
--
http://www.zusammenkunft.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org