Using Procmail as an autoresponder

I’d done this a long time ago and pretty much forgotton all about it. I’ve used procmail for a long time to pre-sort all my mailing list mail among other tasks. I also use it as a mechanism to distribute my gpg public key. If you send me a message with the subject “get key”, you’ll get a response containing my public key in ASCII format. Here’s a snippet from my .procmailrc:

  VERBOSE=off
  PATH=$HOME:/usr/bin:/bin:/usr/local/bin:.
  MAILDIR=$HOME/Mail      # You'd better make sure it exists
  DEFAULT=/var/mail/scotth
  LOGFILE=$HOME/Mail/from
  LOCKFILE=$HOME/.lockfile
  SENDMAIL=/usr/sbin/sendmail

  :0 Wh: msgid.lock   # get's rid of duplicates
  | formail -D 8192 msgid.cache

  # Autoresponder
  :0i
  * !^Subject:.*Re:
  * !^FROM_DAEMON
  * ^Subject:.*get key
  | (formail -r -A "From: scotth@scottharney.com" ; cat $HOME/.pubkey.asc)
      | $SENDMAIL -oi -t

  # SpamAssassin
  :0:
  * ^X-Spam-Status: Yes.*
  $MAILDIR/junk

  # mailing list inet-access
  :0:
  * TO.*inet-access
  $MAILDIR/inet-access

If you just need an autoresponder, you’d just use formail in a .forward. Here’s how I do it using a mail server running qmail. Just create
~/alias/.qmail-autorespond containing the following text

| (/usr/local/bin/formail -r -A "From: autorespond@yourdomain.com" ;
   cat /var/qmail/alias/autoresond.txt) | qmail-inject

Put your autoresponce email body in /var/qmail/alias/autorespond.txt. The ‘qmail-inject’ is qmail’s way of saying ‘/usr/sbin/sendmail -oi -t’.


No Responses to “Using Procmail as an autoresponder”  

  1. No Comments

Leave a Reply



Scott Harney

   (GPG key)
<>

Resume


An online copy of my resume. This resume is suitable for printing but also contains clickable links providing more detail. Just mouse over the bullet items.

Photo Album


My current pictures via Flickr.
Older family pictures.

    Wedding


    I got married on 9/4/2004. So click for details, already.

    Old stuff


    Links and writings from older versions of this site
    Old stuff
    Oldest stuff

    Free DNS