[PLUG] Need help w/ a procmail recipe
Steve Beattie
sbeattie at suse.de
Sun Dec 18 11:06:54 UTC 2005
On Fri, Dec 16, 2005 at 12:35:10PM -0800, Travis Spencer wrote:
> I was wondering if anyone can point out why the following recipes are
> failing to cause all multipart/alternative and multipart/mixed e-mails
> to be converted to plain text and output to the mailbox called other:
>
> LOGABSTRACT=all
> PATH=$HOME/bin:$PATH # munpack is in $HOME/bin.
> TMPDIR=/tmp/procmail.$$
> TRAP="rm -rf $TMPDIR; $TRAP"
> VERBOSE=yes
>
> :0 Wic
> * ^Content-Type: multipart.*
> |mkdir -p $TMPDIR
>
> # Message is multipart/alternative. First part is text
> # and should be discarded. Second part is HTML and should
> # be converted.
> :0 w
> * ^Content-Type: multipart/alternative.*
> |munpack -t -C $TMPDIR && \
> lynx -dump -force_html $TMPDIR/part2 | \
> cat -s
>
> # Message is multipart/mixed or related. HTML is first part.
> :0 w
> * ^Content-Type: multipart.*
> * ! ^Content-Type: multipart/alternative.*
> |munpack -t -C $TMPDIR && \
> lynx -dump -force_html $DIR/part1 | \
> cat -s
>
> :0:
> other
>
> Because none of the commands output their results to a file but serve
> as filters (save mkdir which has been flagged to continue
> regardless), it was my understanding that procmail would continue
> processing the other rules. It does though as you can see from this
> log entry:
It can, but you have to tell procmail to treat the pipe as a filter;
otherwise it expects the piped command to do the final delivery. For a
piped delivery example, my spamassassin capture rule looks like so:
# SpamAssasin adds a header for stuff it thinks is spam.
:0:
* ^X-Spam-Status: Yes,
| gzip >> spam.archive/spam-${MONTH}.gz
because I like to keep an archive of it around, but prefer it take up
as little space as possible.
Perusing my own .procmailrc, all the rules I have that act as filters
are prefixed with:
:0 fw
rather than just the bare:
:0 w
that you have, so you might try that.
A couple of other misc notes, not related to the issue you're having:
- you might wrap up everything into a script, so that you don't have
to have that funny rule+trap to mkdir/rmdir.
- /tmp/procmail.$$ is a pretty guessable/DOSable path, use mktemp(1)
(and create/use a ~/tmp/ as well)
HTH.
--
Steve Beattie
SUSE Labs, Novell Inc.
<sbeattie at suse.de>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20051218/7cfc007f/attachment.asc>
More information about the PLUG
mailing list