procmail
[Top] [All Lists]

Re: annoying metamail warning

2002-11-17 04:02:57
On Thu, 14 Nov 2002, Robert Arnold wrote:


The attachment saving idea sent to the list by Udi Mottelo a few days ago
gave me an idea for a problem I've been having at work. We receive e-mail
that gets sent to a database, and we then access the database via a web
interface. The problem is that e-mail sent in "richtext" form is seen as
an attachment only--which causes a lot of inconvenience for us in order
to get around to viewing the e-mail. So based on Udi's rule for
attachments, I came up with something which allows the richtext
attachment to be seen as just inline plain text:

NL="
"
:0 HB
* $ ^Content.*\.rtf
{
LOG="RTF $NL"
METAMAIL_TMPDIR=/tmp

:0 f
|formail -I "Content-Type: text/plain; charset=us-ascii"

:0 bfw
|/usr/bin/metamail -c text -r -y -w -q -x

#Munge any other "Content" headers in the body
#to insure they're not read

:0 bfw
|cat $METAMAIL_TMPDIR/mm.*|\
perl -pe 's/(^Content-)(.*)/(X-procmail-munged)-$1$2/;
unlink(glob("/tmp/mm.*"));' -
}



...this seems to be working fine, except metamail complains in the
procmail logs:

Warning: Cannot freopen /dev/tty to stdin

...Why doesn't -x suppress this? It's pretty trivial, but I'd like to
understand what the error means and how it can be squelched. Also, if

        The error messages can be squelched be redirecting the stderr
        to /dev/null

|/usr/bin/metamail -c text -r -y -w -q -x 2>&1 /dev/null

        "2>&1"  means that stderr is duplicat of stdout.  Stdout goes to
        /dev/null.

...  Also, if
anyone has an easier, more elegant solution, please share!

        I have a feeling that we can do something with lynx(1) or perl's
        mime module.  But I'v been waiting for that answer too  (:-(

Bye,
 Udi


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>