procmail
[Top] [All Lists]

Re: Procmail receipe help to send auto reply and forward for all users in the domain

2002-11-21 23:25:00
Ruud,

Thank's for your help
I think I came close to achive this with Procmail

But I works fine with Sendmail on Redhat 7 but does not work great with
Solaris 8 Sendmail 8.11.3

The Purpose of this receipe below is :
===============================
Find any message coming in for the domain rupalifinechem.com
Capture the headers in the variables
Modify the domain portion of the "To" header to rajendra-intl.com and then
forward the message  to this new address then notify the Sender of the
message that that the address is changed.

For example
message send to rshah(_at_)rupalifinechem(_dot_)com will be forwared to
rshah(_at_)rajendra-intl(_dot_)com    and the sender will will be notified from 
the
message stored in /etc/mail/autoreply.txt

===============================


here is the receipe :
SHELL=/bin/sh
PATH=/usr/local/bin:/usr/local/sbin:/usr/ucb:/usr/bin:/bin
LOGFILE=/var/log/procmailog
FORMAIL=/usr/local/bin/formail
SENDMAIL=/usr/lib/sendmail
VERBOSE=on

# find intereseting header lines

FROM=`formail -xFrom:`
TO=`formail -xTo:`
T1=`echo $TO > /tmp/to.txt`
T2=`sed -e 's/rupalifinechem.com/rajendra-intl.com/' /tmp/to.txt >
/tmp/t1.txt`
FORWARDTO=`cat /tmp/t1.txt`
CC=`formail -xCc:`
SUBJECT=`formail -xSubject:`
DATE=`formail -xDate:`
:0wc:
* ^To: (_dot_)*(_at_)rupalifinechem(_dot_)com
| ( formail -r -A"X-Loop: $FORWARDTO"; \
  cat "/etc/mail/autoreply.txt"            ) | $SENDMAIL -t
:0A
 ! $FORWARDTO

I dont know why I does not work with Sendmail on Solaris it gets forwarded
with this Receipe to the correct address, but then also send's a NDR to the
Sender with the error message of



The original message was received at Thu, 21 Nov 2002 21:48:35 -0800 (PST)
from root(_at_)localhost

   ----- The following addresses had permanent fatal errors -----
rshah(_at_)rupalifinechem(_dot_)com
    (reason: can't create (user) output file)

   ----- Transcript of session follows -----
550 5.0.0 rshah(_at_)rupalifinechem(_dot_)com(_dot_)(_dot_) Can't create output


Any idea what I may be missing.

Thank you

Rakesh Shah
----- Original Message -----
From: "Ruud H.G. van Tol" <rvtol(_at_)isolution(_dot_)nl>
To: <procmail(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE>
Sent: Tuesday, November 19, 2002 1:42 AM
Subject: Re: Procmail receipe help to send auto reply and forward for all
users in the domain


Rakesh-Shah-Exch skribis:

The Original problem:  Given a hundred users who email addresses have
moved from one company to another. ie user(_at_)A(_dot_)com to 
user(_at_)B(_dot_)com(_dot_)
I needed to forward all messages to the new account and do an auto-reply
to the orignator, with an explaination and the new users email address.

You can not do this properly with procmail, because not all info
is in the mail. A message could be sent to many people(_at_)a(_dot_)com
through Bcc:, in that case there is no info in the From: or the Cc:
to work from.

If there is a Delivered-To: (or something similar), you could work
from that. But you better solve this a few stages earlier (MTA).

--
Affijn, Ruud

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





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