Forum Moderators: phranque

Message Too Old, No Replies

How to set an autoresponder with Procmail?

Recipe grabs the incoming email, but doesn't send response

         

MichaelBluejay

3:56 am on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm a procmail newbie. I'm trying to set an autoresponder to someone who won't take me off his mailing list. I looked through tutorials on the web and set one up, then I sent a message to myself as though it were coming from his name, and the message doesn't make it through (so I know it's being filtered correctly), but the autoresponse doesn't get sent. Below is my code. Any ideas? Thanks, -MBJ-

##################################
###### SPECIFY SYSTEM VARIABLES
##################################
MAILDIR=$HOME/Maildir

PMDIR=$HOME/.Procmail # Directory for storing procmail-related files
SENDMAIL=/usr/sbin/sendmail
LOGFILE=$PMDIR/log # Optional, but recommended
VERBOSE=no # Set to yes when debugging
## LOGABSTRACT=all # Remove ## when debugging; set to no if you want minimal logging

##################################
###### MATCH CERTAIN MESSAGES
###################################

:0:
* ^From.*Mike Schuppe
*!^FROM_DAEMON
*!^FROM_MAILER
*!^X-Loop: myaddress@mydomain.com

#######################################
###### DO SOMETHING WITH THE MESSAGES
#######################################

¦ (formail -rk \
-A "X-Loop: myaddress@mydomain.com" \
echo "Please don't send me any more mail.";\
echo "(This is an automated response.)";)\
¦ $SENDMAIL -t -oi

#######################################
###### CATCH-ALL FOR INBOX
#######################################

:0
$HOME/Maildir/

[edited by: jdMorgan at 4:02 am (utc) on June 29, 2004]
[edit reason] Disabled smilies in code [/edit]

Span

10:35 am on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why bother with automated responses to spammers?

:0:
* ^From: .*notwanted*
/dev/null

MichaelBluejay

8:03 am on Jul 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Who said it was spam? In any event, please trust that I have my own reasons for wanting to handle this (and other similar mailers) with an autoresponder. Can anyone help with what I actually asked about?

mat

8:56 am on Jul 1, 2004 (gmt 0)

10+ Year Member



Far from an expert, but this works for me (using a txt file for the response). Someone will doubtless post that this is the most processor intensive recipe ever seen, but it might at least give you some ideas:

{
:0 h c
¦ (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat /path/to/junkresponse.txt ) ¦ $SENDMAIL -t
:0:
/dev/null
}

MichaelBluejay

7:26 pm on Jul 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I tried to incorporate the last suggestion but I'm still having the same problem. Here's my revised code, followed by the error log (I was just able to figure out how to log the results).

----------------
SENDMAIL=/usr/sbin/sendmail
LOGFILE=$HOME/.procmaillog # Optional, but recommended
#VERBOSE=yes # Set to yes when debugging
#LOGABSTRACT=all # all=full logging; no= minimal logging

:0:
* ^From.*John Doe
*!^FROM_DAEMON
*!^FROM_MAILER
*!^X-Loop: address@mydomain.com

¦ (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat "Your message was tagged as spam and deleted. If it wasn't spam, please visit my website and send your mail through the form there." )\
¦ $SENDMAIL -t

:0
$HOME/Maildir/
--------------------------
procmail: [26204] Thu Jul 1 12:19:05 2004
procmail: Assigning "LOGABSTRACT=all"
procmail: Match on "^From.*John Doe"
procmail: Match on! "(^(Mailing-List:¦Precedence:.*(junk¦bulk¦list)¦To: Multiple recipients of ¦(((Resent-)?(From¦Sender)¦X-Envelope-From):¦>?From )([^>]*[^(.%@a-z0-9])?(Post(ma?(st(e?r)?¦n)¦office)¦(send)?Mail(er)?¦daemon¦m(mdf¦ajordomo)¦n?uucp¦LIST(SERV¦proc)¦NETSERV¦o(wner¦ps)¦r(e(quest¦sponse)¦oot)¦b(ounce¦bs\.smtp)¦echo¦mirror¦s(erv(ices?¦er)¦mtp(error)?¦ystem)¦A(dmin(istrator)?¦MMGR¦utoanswer))(([^).!:a-z0-9][-_a-z0-9]*)?[%@> ][^<)]*(\(.*\).*)?)?$([^>]¦$)))"
procmail: Match on! "(^(((Resent-)?(From¦Sender)¦X-Envelope-From):¦>?From )([^>]*[^(.%@a-z0-9])?(Post(ma(st(er)?¦n)¦office)¦(send)?Mail(er)?¦daemon¦mmdf¦n?uucp¦ops¦r(esponse¦oot)¦(bbs\.)?smtp(error)?¦s(erv(ices?¦er)¦ystem)¦A(dmin(istrator)?¦MMGR))(([^).!:a-z0-9][-_a-z0-9]*)?[%@> ][^<)]*(\(.*\).*)?)?$([^>]¦$))"
procmail: Match on! "^X-Loop: address@mydomain.com"
procmail: Couldn't determine implicit lockfile from " (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat "Your message was tagged as spam and deleted. If it wasn't spam, please visit my website and send your mail through the form there." )\
¦ $SENDMAIL -t"
procmail: Locking ".lock"
procmail: Executing " (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat "Your message was tagged as spam and deleted. If it wasn't spam, please visit my website and send your mail through the form there." )\
¦ $SENDMAIL -t"
procmail: Assigning "LASTFOLDER= (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat "Your message was tagged as spam and deleted. If it wasn't spam, please visit my website and send your mail through the form there." )\
¦ $SENDMAIL -t"
procmail: Unlocking ".lock"
procmail: Notified comsat: "myaccount@:/home/myaccount/ (formail -t -r -A"X-Loop: address@mydomain.com " ; \
cat "Your message was tagged as spam and deleted. If it wasn't spam, please visit my website and send your mail through the form there." )\
¦ $SENDMAIL -t"
From john@johndoe.com Thu Jul 1 12:19:05 2004
Subject: from ms-pm
Folder: (formail -t -r -A"X-Loop: address@mydomain.com " 996