procmail
[Top] [All Lists]

Re: Auto-Reply with all headers

1997-02-21 10:56:28
dnhunt(_at_)rain(_dot_)org writes on 18 February 1997 at 17:50:53
On Tue, 18 Feb 1997, Roy Rapoport wrote:
Howdy, all.  I'm sure this must have been done before, but I'm
looking to implement an auto-reply mechanism that will basically do
something like send the original poster a message of the form

Your message was received by <whoever> in this form, including all
headers and the body:

<All headers>
<body>

Roy, there are a number of ways to do this, and here is one way that I
currently send autoreplies as you describe with the original full

Here's what I use at loopback(_at_)bristol(_dot_)com

   Dan
----
# 
# J. Daniel Smith
# 1 May 1996
#
# loopback.rc - bounce a message back to the sender
#

#####
##### Initial setup needed for *all* procmail invokations
#####
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin
SHELL=/bin/sh

MAILDIR=/tmp

# log everything verbosely, since I want to see how all this works
# this needs to be near the beginning of the file to turn logging on ASAP
#LOGFILE=$MAILDIR/LOG
#VERBOSE=on

# define the local top-level domain and fully-qualified domain names
DOMAIN=bristol.com
FQDN=${DOMAIN}

#####
##### Extract/generate interesting mail headers
#####
# get the date in RFC822 format for insertion into some messages;
# the "Resent-Date:" field is copied from the "Date:" field on some systems.
# RFC1123 says "All mail software SHOULD use 4-digit years in dates..."
# sun4 doesn't recognize all "date" flags
#year=`date '+%y'`
#DATE=`cent=19; if [ $year -lt 70 ]; then cent=20; fi; date "+%a, %d %h $cent%y 
%T EST"`
DATE=`date '+%a, %d %h %Y %H:%M:%S %Z'`

# prevent mail loops
:0
* ^FROM_DAEMON
/dev/null

# large messages are simply bounced back; 69 = EX_UNAVAILABLE
TRAP="exit 69;"
EXITCODE=69
:0
* > 7000
/dev/null
EXITCODE=0
TRAP=""

HOSTNAME=`hostname`
:0c:
loopback.$$
:a
|(formail -rt \
          -I "Reply-To: Postmaster(_at_)$DOMAIN" \
          -I 'Precedence: junk' \
          -I 'MIME-Version: 1.0' \
          -I 'Content-Type: multipart/mixed; boundary="-- next item ----"'; \
  echo "This is the preamble of an RFC-1521 encoded, mixed message."; \
  echo "---- next item ----"; \
  echo "Content-Type: text/plain"; \
  echo "Context-Description: bristol.txt"; \
  echo ""; \
  echo "Your message was received at $DOMAIN on $DATE"; \
  echo "Bristol Technology is the leading supplier of cross-platform"; \
  echo "development solutions, including Wind/U, HyperHelp and XPrinter."; \
  echo "For details, visit our WWW site at http://www.bristol.com";; \
  echo ""; \
  if [ "$HOST" != "" ]; then \
    echo "This machine ($HOST) is located at the Bristol offices:"; \
  else \
    echo "This machine ($HOSTNAME) is located at the Bristol offices:"; \
  fi; \
  echo "41.28N -73.45W; 241 Ethan Allen Hwy, Ridgefield, CT; +1 203 438 6969"; \
  echo ""; \
  echo "Questions about this message should be sent to 
postmaster(_at_)$DOMAIN"; \
  echo "---- next item ----"; \
  echo "Content-Type: message/rfc822"; \
  echo "Context-Description: bounce.txt"; \
  echo ""; \
  formail -I "From " < $MAILDIR/$LASTFOLDER; \
  echo "---- next item ------"; \
  ) | ($SENDMAIL -t; rm -f $MAILDIR/$LASTFOLDER)

# don't want to save any messages away
:0
/dev/null

<Prev in Thread] Current Thread [Next in Thread>