Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Off Topic - Procmail help

Status
Not open for further replies.

Rhinokiller

IS-IT--Management
May 20, 2003
223
US
Below is my standard vacation auto responder which works just fine if incomming email is addressed to user@mydomain.com. However if mail arrives to the same user at email address user.lastname@mydomain.com, the autoresponder just delivers the mail. If anyone has any ideas on how to modify this to check incomming mail for user@mydomain.com aswell as user.lastname@mydomain.com I'd appreciate it.

FORMAIL=/usr/bin/formail
SENDMAIL=/usr/sbin/sendmail
SHELL=/bin/sh
MAILDIR=/var/spool/mail/username

### Vacation Recipe ###
:0 Whc: user.lock
# Check to see if mail was addressed to user
* $^To:username@mydomain.com
# Don't Reply To Daemons and mailling lists
* !^FROM_DAEMON
* !^X-Loop: user@mydomain.com
* !^X-Loop: user.lastname@peigenesis.com
| FORMAIL -rD 8192 user.cache
:0c eh # if the name was not in the cache
| (formail -rI&quot;Precedence: junk&quot; -I &quot;From: Auto Responder <autoresponder@mydomain.com>&quot; ;

-A&quot;X-Loop: user@mydomain.com&quot; ; echo &quot;I received your email, however I will be out of the office

until next week.&quot; ; echo &quot;If you have an issue that requires immediate attention please contact

some_one_else@mydomain.com&quot; ; echo &quot;Thank you.&quot;) | sendmail -oi -t

There is no God, only 10001010
 
Rhinokiller,
It looks like to me that your recipe is only testing for username@mydomain.com and that's the one that works right? You could either add another recipe below the first one testing for user.name, or maybe this will work:

#Recipe 1
:0 Whc: user.lock
# Check to see if the mail was addressed to user
* $^To:.*user
# Don't reply to daemons and mailinglists
* !^FROM_DAEMON
* !^X-Loop: user@mydomain.com
| formail -rD 8192 user.cache
:0c eh # if the name was not in the cache
| (formail -rI&quot;Precedence: junk&quot; -I&quot;From: Auto Replier <autoreplier@mydomain.com>&quot; ; -A&quot;X-Loop: user@mydomain.com &quot; ; echo &quot;I received your mail,&quot; ; echo &quot;however I will be out of the office &quot; ; echo &quot;through March 6th. If you have an issue &quot; ; echo &quot;that must be dealt with immediately, please &quot; ; echo &quot;send your email to: info@mydomain.com &quot; ; echo &quot;Thanks very much. &quot; ; echo &quot; User &quot; ; echo &quot;-- user@mydomain.com&quot; ) | $SENDMAIL -oi -t

So if your 'user' is named john.doe, then the above should fire on all incoming mail addressed to john@mydomain or john.doe@mydomain. If you have more than one john in your org, then you'll have to qualify the name in your recipe. In that case I'd use two recipies, one for john@mydomain and another for john.doe@mydomain



Hope that helped.
Keith
 
You are exactly right, my problem arises when I have more than one &quot;John&quot;. I tried stacking the recipies as you suggested but I had no success. The first vac recipe is invoked (testing for user@mydomain.com) but for some reason the second vac. recipe (testing for user.lastname@mydomain.com)is ignored.
Am I missing something in how they are supposed to be stacked ? I just ran one right after the other.

There is no God, only 10001010
 
Hi Rhinokiller,
Add this to the top of your \etc\promcailrc:

LOGFILE=/var/log/pm.log
LOG=&quot;
&quot;
VERBOSE=yes
# Remove ## when debugging; set to no if you want minimal logging
LOGABSTRACT=yes

The pm.log log file will help. First I wonder about the lock-file - that may have to be unique for each recipe in the rc. As far as the recipe stacking, you should be able to dup everything from the opening :0 thru the -oi -t. (I run the procmailrc from \etc so it's global on my server.)
So if you copied my recipe twice & fixed the 'user' in each recipe
(like :0 Whc: user.lock to :0 Whc: user.name.lock)?

Also, can you take out the test for the other user in each recipe?
* !^X-Loop: user@peigenesis.com
* !^X-Loop: user.lastname@peigenesis.com
so each recipe looks for unique condition?

Lemme know,
Keith
 
Thanks rouse01,
setting the unique condition for X-Loop looks like it did the trick.

There is no God, only 10001010
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top