Hello all,
I am new to this list but I have put quite a bit of time
looking for answers in the many FAQs and online materials.
I *almost* managed to get a recipie to do what I wanted, but
I'm stumped on the last part.
What I am trying to do is configure procmail to reject
incoming messages based on the size of the message (done). If
the message is above a certain size, then I want to bounce
the message back with a generic error (done) and INCLUDE THE ORIGINAL
HEADERS in the response (not done). It's that "include the
headers" part that I'm having trouble with!
What I want to know is how I can store a good copy of the
message headers in a variable or something which can then
be used in my auto-reply? I've tried storing the headers
in a variable but the carriage returns are lost (and there's
a finite limit to the length of headers that can be stored
in a variable).
Here's my recipie so far. If there's a better way to do
what I want please let me know! I'm still learning...
-- cut here --
SHELL=/bin/sh
PATH=/usr/local/bin:/bin:/usr/bin
LOGFILE=/tmp/log.amsinternal
VERBOSE=yes
MAXMSGSIZE=10000
MAX_INBOX_SIZE=200000
#
# Bounce messages which exceed the MAXMSGSIZE variable
#
:0
* > ${MAXMSGSIZE}
{
#
# Get the subject line of the offending piece of mail
#
:0 h
SUBJECT=|formail -x "Subject:"
#
# Generate the auto-reply
#
:0 h
* !^FROM_DAEMON
* !^X-Loop: X-BOUNCE-FILE-SIZE
| (formail -rt \
-I"Subject: Returned Mail: ${SUBJECT}" \
-I"From: MAILER-DAEMON(_at_)${HOST}" \
-A"X-Max-Message-Size: ${MAXMSGSIZE} bytes" \
-A"X-Bounced-Reason: Maximum Message Size Exceeded" \
-A"X-Loop: X-BOUNCE-FILE-SIZE" ; \
cat /usr/local/etc/autoreplies/bounce-file-size ) | $SENDMAIL -t
#
# Trash the message
#
:0 h
/dev/null
}