procmail
[Top] [All Lists]

Re: Altering "From " line When Bouncing Messages

1998-03-08 00:42:11
On Sat, 7 Mar 1998, Trevor Astrope wrote:

On Fri, 6 Mar 1998, David Hunt wrote:
On Fri, 6 Mar 1998, Trevor Astrope wrote:
Hi, I'm wondering if it is possible to alter the "From " line that gets
appended to messages that my procmail recipes bounce back to the sender.
Right now, the unqualified domain name of my Linux box is sent as the
"From " line and some mail servers refuse these messages. I would like to
put my real email address there instead.

Not hard. But the method used depends on the recipe you're using,
specifically whether or not there is any 'From ' line at all in the mail
as it leaves procmail. Show us your recipe.
David Hunt

Sure. Actually, I have this problem with a few recipes I was hoping to
solve with one fix. Anyway, here goes...

I was wrong. It is hard.

These recipes begin "|formail -r" or "-rk", which doesn't generate a 
'From ' line. That would require breaking the recipes apart and building a
'From ' line, and inserting it ahead of the header. The shortest route to
that end that I can think of is capture the formail output into a var,
then use a recipe after that, that echos a 'From ' line, then echos the
var, output to sendmail. That's not as pretty as slipping in a sed
command. I offer here a clumsy, untested idea. And even if the recipes
work, there is no guarantee your system wouldn't change it again. I would
talk to the system administrator and see if they can change something on
their end first, because that is where the faulty 'From ' is being
inserted.

David Hunt

Crude recipes follow:

Your first recipe uses this to do the mailing:

        :0
    | (formail -rtk -A"X-Mailer: Procmail Autoreply" \
    -A"X-Loop: astrope(_at_)tabbweb(_dot_)com" ; \
cat $HOME/no_HTML_please) | $SENDMAIL -oi -t

Which could be changed to:

        REPLY_MESSAGE=`formail -rtk -A"X-Mailer: Procmail Autoreply" \
        -A"X-Loop: astrope(_at_)tabbweb(_dot_)com"`
        :0iw
        |(echo "From astrope(_at_)tabbweb(_dot_)com  `date +'%a %b %e %T %Y'`";\
        echo "$REPLY_MESSAGE";cat $HOME/no_HTML_please;echo)\
        |$SENDMAIL -oi -t

The next recipe you offered is:
:0
* ^TOsupport
*!^X-Loop: support(_at_)pacocorp(_dot_)com
|(formail -r -A "Precedence: junk"\
-I"Return-Path: <daemon(_at_)pacocorp(_dot_)com>" \
-I"From: Technical Support <support(_at_)pacocorp(_dot_)com>" \
-I"Subject: Confirmation" \
-A "X-Loop: support(_at_)pacocorp(_dot_)com";\
cat $FILEDIR/confirm.txt )|$SENDMAIL -t

This could be changed to:

        :0
        * ^TOsupport
        *!^X-Loop: support(_at_)pacocorp(_dot_)com
                {

                REPLY_MESSAGE=`formail -r -A "Precedence: junk"\
                -I"From: Technical Support <support(_at_)pacocorp(_dot_)com>" \
                -I"Subject: Confirmation" \
                -A "X-Loop: support(_at_)pacocorp(_dot_)com"`

                :0iw
                |(echo "From daemon(_at_)pacocorp(_dot_)com  `date +'%a %b %e 
%T %Y'`";\
                echo "$REPLY_MESSAGE";echo;cat $FILEDIR/confirm.txt;echo)\
                |$SENDMAIL -t

                }