At 16:49 2009-08-18 -0400, CT Guy wrote:
I want to take email coming from any sender going to
president(_at_)mydomain(_dot_)com(_dot_)
When procmail identifies that president(_at_)mydomain(_dot_)com, I want it to
kick a text file to presidentsworkemail(_at_)domain(_dot_)com (saying that an
email is in your personal email account) and then pass the message
through to presidentsPERSONALemail(_at_)domain(_dot_)com(_dot_)
What would the instructions be that I would add to the procmail file?
Well, you need to determine whether you ever want the original sender to
become aware of delivery problems, which may reveal one or both of the
"behind the scenes" email addresses.
Also, what access do you have to the MTA configuration, and is the procmail
instance running on behalf of a user account with a number of email
addresses (aliases), or just the one?
The following is cobbled up here for you - it is untested, but should be
easy enough for you to adjust to your needs. daemon messages are
problematic - reasonably, your user should want to know about bounces for
messages they send, but at the same time, the daemon messages could be
indicative of a mail loop. Since this example changes the envelope sender
of the messages, it should be possible to NOT exclude daemon messages from
the forwarding - thus allowing your user to get bounces of their own sent
messages, but not inviting a mail loop if their own account develops
delivery issues.
# define the email address to use for redirected bounces and loop avoidance.
$BOUNCER=NoReply(_at_)example(_dot_)tld
# first, match for any recipient. Note that BCCs with multiple local
# recipients can cause this test to fail with some MTAs, so you're best off
# directing messages for this address via the MTA config to a unique procmail
# invocation.
# note that the X-Loop check against BOUNCER escapes it so that the variable
# will be regexp-escaped (the dot for instance will be treated as a dot, not
# a wildcard). This is intended to redirect any delivery bounces.
:0
* ^TO_president(_at_)example\(_dot_)tld
* !^FROM_DAEMON
* !^X-Loop: $\BOUNCER
{
# send a copy along to personal account
# we do this in a nonstandard fashion, so that bounces DO NOT GO TO
# THE ORIGINAL SENDER, WHICH WOULD EXPOSE THE PERSONAL EMAIL ADDRESS.
:0c
| $SENDMAIL presidentsPERSONALemail(_at_)example(_dot_)tld -f $BOUNCER
# now, with the remaining (original) message, we just use it to
# send a notice
# newmail.msg is a text file you could put a canned explanation in
# to be included as the plaintext body of the notice.
:0
| (sed -e '1d' | cat newmail.msg - | \
formail -I "Subject: New mail advisory" \
-I "To: presidentsWORKemail(_at_)example(_dot_)tld" \
-I "X-Loop: $BOUNCER" \
-I "From: $BOUNCER (No Reply robot)" ) \
| $SENDMAIL -t -f $BOUNCER
}
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail