PDF attachments

416 views
Skip to first unread message

MossyRock

unread,
Sep 25, 2011, 12:52:52 PM9/25/11
to K-9 Mail, emea...@myofficetechllc.com
Smartphone: Droid X2, Gingerbread

I discovered today that K-9 apparently uses the "content-type" tag in
an email for an attachment to find out what app to use to open the
attachment.

Here's what happened: an email was sent out from a server-based
proposal system (Pursuit 7, in fact) with a PDF attachment. We opened
the email in K-9, and we then attempted to open the PDF attachment,
but K-9 said "Unable to find viewer for application/x-unknown".

I then manually sent out an email from my laptop (using Thunderbird)
with this exact same PDF attached. We opened this email in K-9 and
were able to open the PDF attachment with no problem (it gave us a
choice of Adobe Reader or QuickOffice, BTW, just like normal).

I looked into the internal source code of the first email and it had
this:

Content-Type: application/x-unknown; name="PROPOSAL1001293.PDF"
Content-Transfer-Encoding: base64 Content-Disposition: attachment;
filename="PROPOSAL1001293.PDF"; size=8922

Next, I looked into the internal source code of the second email and
it had this:

Content-Type: application/pdf; name="PROPOSAL1001293.PDF" Content-
Transfer-Encoding: base64 Content-Disposition: attachment;
filename="PROPOSAL1001293.PDF"; size=8922

I don't think the Pursuit 7 software vendor is going to fix their
email engine, so I'm trying to find a way to work around this with
K-9. If K-9 would use the attachment's extension (".pdf") instead of
the content-type tag then there would be no problem.

Any ideas, anyone?

Thanks.

Bernhard Redl

unread,
Sep 25, 2011, 5:25:14 PM9/25/11
to k-9-...@googlegroups.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

sry but going after file ext. is not the standard.
I think we should not ignore the content-type and start guessing.

You are always free to long press the Save button and save the
attachment to the filesystem.
once saved linux will be able to identify the mimetype itself
(independent of the file ext.)

just my 2 cents.
- -aatdark

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5/nDgACgkQ9wU+3S/MK7RfDgCdHiasegBl5CvBxWf+6Thux8C/
P3sAniJVFZdbSY5EJOCEuyqKxm6WAI6j
=OS/N
-----END PGP SIGNATURE-----

Pete Holsberg

unread,
Sep 25, 2011, 6:26:11 PM9/25/11
to k-9-...@googlegroups.com
I tried to open a PDF attachment in K-9 mail and got an error message, so I saved it and tried to open it with Acrobat Reader but that failed too.

No problem on my PC using Thunderbird and EZPDFReader.

???


Bernhard Redl has written on 9/25/2011 5:25 PM:

Dennis Rockwell

unread,
Sep 25, 2011, 7:22:04 PM9/25/11
to k-9-...@googlegroups.com
Bernhard Redl <bernha...@gmail.com> wrote:

> sry but going after file ext. is not the standard.

Right; welcome to the world of arrogant software.

> I think we should not ignore the content-type and start guessing.

I don't know the Android APIs, but if K-9 still has control and can detect the failure, or parses out the Content-type header itself, it would make sense to try the system handler first, and if it fails, *then* inspect the filename, construct a Content-type to match, and try the system handler again.


Dennis

Sent from my Nook Color with K-9 Mail. Please excuse my brevity.

Bernhard Redl

unread,
Sep 25, 2011, 7:30:32 PM9/25/11
to k-9-...@googlegroups.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi
what does error does adobe reader show, when you try to open the saved
attachment.
did you save the attachment to the sdcard?


On 09/26/2011 12:26 AM, Pete Holsberg wrote:
> I tried to open a PDF attachment in K-9 mail and got an error
> message, so I saved it and tried to open it with Acrobat Reader
> but that failed too.
>
> No problem on my PC using Thunderbird and EZPDFReader.
>
> ???
>
>
> Bernhard Redl has written on 9/25/2011 5:25 PM: sry but going after

> file ext. is not the standard. I think we should not ignore the
> content-type and start guessing.
>
> You are always free to long press the Save button and save the
> attachment to the filesystem. once saved linux will be able to
> identify the mimetype itself (independent of the file ext.)
>
> -- You received this message because you are subscribed to the K-9
> Mail Users List. To post to this group, send email to
> k-9-...@googlegroups.com To unsubscribe, email
> k-9-mail+u...@googlegroups.com To report an issue with K-9
> Mail, visit http://code.google.com/p/k9mail/issues/list For more
> options, visit this group at
> http://groups.google.com/group/k-9-mail


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5/uZUACgkQ9wU+3S/MK7TQEQCdF4Ciqk1gbuD0bpaRrx0W9Jw8
b6AAn05mNTSOVpskM4Wf1fySzOCaI7a5
=jfpP
-----END PGP SIGNATURE-----

Bernhard Redl

unread,
Sep 25, 2011, 7:38:19 PM9/25/11
to k-9-...@googlegroups.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/26/2011 01:22 AM, Dennis Rockwell wrote:
> I don't know the Android APIs, but if K-9 still has control and can
> detect the failure, or parses out the Content-type header itself,
> it would make sense to try the system handler first, and if it
> fails, *then* inspect the filename, construct a Content-type to
> match, and try the system handler again.

If we provide an own mechanism to recover the Content-Type from
fileextention we need to handle every common format. Because this
issue seems to only affect very very few people - it's not likly to be
implemented asap.

but please fill an new enhancement at our issuetracker.
http://code.google.com/p/k9mail/


>
>
> Dennis
>
> Sent from my Nook Color with K-9 Mail. Please excuse my brevity.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5/u2sACgkQ9wU+3S/MK7Q6YwCdFv26Hp033/ZqlzNnwISOHhpJ
hCQAnRl9WBru1YeOIoY2PgvWDNc38VDG
=IIZn
-----END PGP SIGNATURE-----

cketti

unread,
Sep 25, 2011, 7:42:13 PM9/25/11
to k-9-...@googlegroups.com
On 26.09.2011 01:22, Dennis Rockwell wrote:
> Bernhard Redl <bernha...@gmail.com> wrote:
>
>> sry but going after file ext. is not the standard.
>
> Right; welcome to the world of arrogant software.

Try not to insult the people you just asked to fix your problem for free.


>> I think we should not ignore the content-type and start guessing.
>
> I don't know the Android APIs, but if K-9 still has control and can
> detect the failure, or parses out the Content-type header itself, it
> would make sense to try the system handler first, and if it fails,
> *then* inspect the filename, construct a Content-type to match, and
> try the system handler again.

In theory this is a good idea. But there are applications, e.g. APG,
that tell Android they can handle any MIME type ("*/*"). So for K-9 Mail
it looks like there's an application installed that can handle the funny
MIME type and the fallback method is never used.

I think a more practical solution is to blacklist
"application/x-unknown" and always use the file type lookup method in
that case. Just like we do for the MIME type "application/octet-stream"
right now.

Pete Holsberg

unread,
Sep 25, 2011, 7:45:56 PM9/25/11
to k-9-...@googlegroups.com
When I try to open the attachment in K-9, by first touching "Download complete message" and then "Open", I get a choice of PDF readers, both of which work without problems.

I tried saving the file.

When I open Astro file manager and press the filename, I get the same choice of readers and both give this error message:

"This document cannot be opened because it is corrupted or damaged."

OK, I see the problem. I must have forgotten to press "Download complete message" the first time.

Sorry.



Bernhard Redl has written on 9/25/2011 7:30 PM:

Andrew Black

unread,
Sep 25, 2011, 11:53:21 PM9/25/11
to k-9-...@googlegroups.com


On Sep 25, 2011 11:26 PM, "Pete Holsberg" <pj...@pobox.com> wrote:
>
> I tried to open a PDF attachment in K-9 mail and got an error message, so I saved it and tried to open it with Acrobat Reader but that failed too.
>

What is the error?

Have you tried copying from PC onto your phone (eg via USB). The will show whether Acrobat dislikes the PDF or K-9 is mangling it.

Dennis Rockwell

unread,
Sep 26, 2011, 5:56:45 AM9/26/11
to k-9-...@googlegroups.com
cketti <cke...@googlemail.com> wrote:

> On 26.09.2011 01:22, Dennis Rockwell wrote:
> > Bernhard Redl <bernha...@gmail.com> wrote:
> >
> >> sry but going after file ext. is not the standard.
> >
> > Right; welcome to the world of arrogant software.
>
> Try not to insult the people you just asked to fix your problem for
> free.

I was unclear; I was insulting the developer of the software that tagged a PDF file as "unknown" for Microsoft-class laziness, not K-9.

> In theory this is a good idea. But there are applications, e.g. APG,
> that tell Android they can handle any MIME type ("*/*").

Add that app to the "avoid" list...

> So for K-9 Mail
> it looks like there's an application installed that can handle the funny
> MIME type and the fallback method is never used.

So the "handle this" API doesn't tell K-9 that the handling app failed to handle it? That would probably rely on the failing app to actually admit failure...

> I think a more practical solution is to blacklist
> "application/x-unknown" and always use the file type lookup method in
> that case. Just like we do for the MIME type
> "application/octet-stream" right now.

So there's already a mechanism in place that can do the job with a little tweak? Great!

MossyRock

unread,
Sep 26, 2011, 10:37:37 PM9/26/11
to K-9 Mail
I'm not seeing an option or button to "Download complete message".
What is the click/tap path to get to this, or where should it be
visible? If I'm not seeing it, does this mean that I already have the
complete message?

Thanks
> > > Mail, visithttp://code.google.com/p/k9mail/issues/listFor more
> > > options, visit this group at
> > >http://groups.google.com/group/k-9-mail
>
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.10 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

MossyRock

unread,
Sep 26, 2011, 10:41:33 PM9/26/11
to K-9 Mail
Thanks... yes, that's what we're having to do - save it to the
filesystem. But IMHO, if every mainstream desktop email client can
successfully open this very same PDF attached to this very same email,
then K-9 is sort of out in left field on this, so to speak.
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

Pete Holsberg

unread,
Sep 26, 2011, 11:26:54 PM9/26/11
to k-9-...@googlegroups.com
I got that message because I had the limit set too small.
--
Sent from my HTC EVO 4G with K-9 Mail. Please excuse tpyos.

John F. Eldredge

unread,
Sep 26, 2011, 11:37:14 PM9/26/11
to k-9-...@googlegroups.com
If a message shows up in the list with a gray background, you don't have all of it. Open the message and scroll to the end of the message, and you will see the "get complete message " button.

--
John F. Eldredge -- jo...@jfeldredge.com
"Reserve your right to think, for even to think wrongly is better than not to think at all." -- Hypatia of Alexandria

Tanstaafl

unread,
Sep 27, 2011, 7:07:51 AM9/27/11
to k-9-...@googlegroups.com, John F. Eldredge
John,

Bottom posting WITHOUT trimming the quoted text is FAR worse than top
posting.

Please trim your posts.

> To report an issue with K-9 Mail, visithttp://code.google.com/p/k9mail/issues/list
> For more options, visit this group athttp://groups.google.com/group/k-9-mail


>
>
> I got that message because I had the limit set too small.
> --
> Sent from my HTC EVO 4G with K-9 Mail. Please excuse tpyos.
>
>
> If a message shows up in the list with a gray background, you don't have
> all of it. Open the message and scroll to the end of the message, and
> you will see the "get complete message " button.
>
> --
> John F. Eldredge -- jo...@jfeldredge.com
> "Reserve your right to think, for even to think wrongly is better than
> not to think at all." -- Hypatia of Alexandria
>
> --
> You received this message because you are subscribed to the K-9 Mail
> Users List.
> To post to this group, send email to k-9-...@googlegroups.com
> To unsubscribe, email k-9-mail+u...@googlegroups.com
> To report an issue with K-9 Mail, visit
> http://code.google.com/p/k9mail/issues/list
> For more options, visit this group at
> http://groups.google.com/group/k-9-mail
>

Pete Holsberg

unread,
Sep 27, 2011, 11:51:00 AM9/27/11
to k-9-...@googlegroups.com
VERY difficult to do in K-9 using SwiftKey!!

Tanstaafl has written on 9/27/2011 7:07 AM:
Reply all
Reply to author
Forward
0 new messages