[plug] Emailing - gotchas

Bernd Felsche bernie at innovative.iinet.net.au
Thu Jul 1 12:03:33 WST 2004


I spent a couple of hours getting splinters while scratching my head
on this one...

It's not Linux-specific, but illustrates a trap that could catch you
if you're only thinking on the Linux-side.

I write some software that accepts PCL-formatted output and
transforms it to PDF for emailing to other parties. (GhostPCL does
all the hard work!) It all works a treat until... Lookout! gets in
the way. :-(

The PDF was sent as an attachment using "nail".

No reasonable mail reader I tried had any problem with that so I
released for final testing. One user runs the process and has the
document mailed to her; clicks on the attachment name in Lookout!
and Acroread complains bitterly... won't grok the PDF.

I had judiciously retained the intermediate, but not the PDF file
but had a trace of the internal commands and arguments applied so
repeated the same process on a command line; directing the result to
my email address whereupon the required PDF appeared and I was able
to view it properly under Linux with KMail and mutt.

The original, offending attachment was emailed to me and Acroread
wouldn't open in KMail either... The saved attachment was even the
wrong size so I suspected that there may have been a user
environment or permissions issue. After chasing down those
possibilities, I arrived at dead ends. Fired up mutt, saved out the
original "corrupted" attachment using mutt and was able to
successfully view the attachment.

So it was the MIME-handling in the reader that caused the problem.
Lookout! had messed up the MIME when forwarding the original email
with "corrupt" attachment which confused KMail but mutt had somehow
untangled the mess.

I hadn't named the PDF as *.pdf in the mailing wrapper, so nail made
it an application/text attachment in the MIME header. I changed the
mailing wrapper program to have the intermediate file with a pdf
extension and "nail" then changed the MIME header to
application/pdf.

Even Lookout! then processed the resulting attachment as expected.

Unfortunately, I can no longer use the mailing wrapper program for
generic purposes; not without some changes to detect MIME type and
rename the file before attaching ... <sigh>

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!






More information about the plug mailing list