procmail
[Top] [All Lists]

formail autoreply feature question (reversing from/to fields)

2000-10-05 05:12:14
Hi List,

Is there an easy way of getting the functionality of '-r'
(generate autoreply headers) while keeping the original
To field?

Imagine the following; Users have adresses like 
foo(_dot_)bar(_at_)company(_dot_)com,
which eventually is delivered to a pop account at hosting.com.

However, if one generates autoreplies via formail/procmail and
send it through sendmail, then the From field will contain
"popaccount(_at_)hosting(_dot_)com", which confuses the orignal sender,
since he sent it to foo(_dot_)bar(_at_)company(_dot_)com(_dot_)

What I'd like is a way to essentially swap From and To headers,
making it appear as the mail was sent from the user who it was
addressed for. Maybe an additional flag to -r would do the trick?
(but I have not found any)

I've come up with this "solution", does anyone know an easier way?


1. Rename the To field to From, getting an 'Old-From' field.
2. Run it through formail once again, renaming Old-From to To
3. Weed out the other headers, like '-r' does.

In formail language it comes down to:

formail -R To: From: -iFrom:  | \
formail -R Old-From: To -X From: -X To: -X References: -X X-Loop: -X \
-X In-Reply-To:

Another way around would be this, using the original -r behaviour:

1. first, rename To to From, and use -i to get the Old-From header.
2. run it through 'autoreply', keeping From field, and renaming
   Old-From to From

formail -R To: From: -i From: |formail -ri From -R Old-From From -U From

I came up with the last solution as I wrote this mail,
I think it's quite neat.

Comments?

btw, the procmail recipe currently looks like this:

:0 ehc         # if the name was not in the cache
| (formail -rI"Precedence: vacation" \
-A"X-Loop: looping" -i"From: `cat ~/.my_email`" ; \
cat ~/.vacation-message \
) | $SENDMAIL -oi -t


Regards,
 Stefan



_______________________________________________
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>
  • formail autoreply feature question (reversing from/to fields), Stefan Alfredsson <=