Change Content-Type to application/pdf

Change Content-Type to application/pdf

Post by Martin Sto » Thu, 21 Jul 2005 23:58:54


Hi,
perhaps someone finds this useful too.

Here is a procmail recipe in combination with a perl filter
to change the content-type from
application/octet-stream to application/pdf for attached files
whose name ends in ".pdf"

### snip ###
:0 Bfw
*^Content-Type: application/octet-stream;
|perl -T -n -w -e 'if ( m/^Content-Type: application\/octet-stream;/ ) {
$ct=$_; $nl=<>; if ( $nl=~m/\.(pdf|PDF)\"$/ )
{$ct=~s/octet-stream/pdf/}; print $ct; print $nl; } else { print; }'
### snap ###

Note: All lines after the first | should be on one line.

Martin

--

Martin Stockinger, Dipl.-Inform. (FH)
 
 
 

Change Content-Type to application/pdf

Post by Alain Benc » Sat, 23 Jul 2005 01:55:43

Hello Martin,




Thanks Martin. People nervous about modifying original mailbox can
use the mime_lookup feature of Mutt 1.5.9 changing type harmlessly on
the fly, like that:

| muttrc: mime_lookup application/octet-stream
| mime.types: application/pdf pdf


Bye! Alain.
--
Software should be written to deal with every conceivable error
RFC 1122 / Robustness Principle