[plug] Emailing - gotchas

Craig Ringer craig at postnewspapers.com.au
Thu Jul 1 12:17:55 WST 2004


Bernd Felsche wrote:

> 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.

If you were sending PDF files as text/plain then I suspect LookOut! was 
in fact in the right. Did you try any other mail clients under Windows 
to see if they also had the problem? If I understand correctly, they 
should have.

I'd say that mutt etc worked fine because text/plain only matters when 
you're communicating between platforms that use different line endings. 
Sending a PDF from Windows as text/plain and opening it on Linux should 
probably have shown the same problem.

The fix, as you found, is to use the correct MIME type so that MTAs and 
MUAs won't attempt to translate line endings.

Even better, Base64-encode your attachments so that line-ending 
translation won't matter. A simple example that uses the email package 
for Python (and ReportLab to generate the PDF - feel free to replace 
that bit with loading a PDF from a file instead) is attached.

--
Craig Ringer
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pdfmail_test.py
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20040701/49ef8bcc/attachment.ksh>


More information about the plug mailing list