sibr.reply.py

What does this program do?

This is an auto-reply program that can work with any Postfix based email servers, and could be made to work with Sendmail. It is easy to install and use, and since it is activated via email, it doesn't require any extra services for the user to manager their auto-replies.

How does it work?

The script requires that an email account be set up for its use. It will poll this account every time it is run, and first determine whether this is a command sent directly to the auto-reply account, or if it was an email directed at a user with an active auto-reply.

Configuration

The following variables will need to be set before this script can be used:

  • kDomain: must be set to the domain that should be added to the account names.
  • kQueueAccount: name of POP account handling auto-reply messages
  • kQueuePassword: password used to access the POP account
  • kPOPAddress: the host name or IP address to use for accessing the POP account
  • Add execute permissions for script w/ chmod u+x sibr.reply.py or a similar cmd.

Unless you change the source, you must create a folder sibr.reply at /usr/share. Then copy the sibr.reply.py script (with execute permissions) and the template messages into this directory.

Be sure to edit all 3 message files. You'll need to replace any occurences of yourdomain.com with the appropriate domain name, as well as editing the help messages to taste:

  • activateMsg.txt
  • deactivateMsg.txt
  • usageHelpMsg.txt

A cron entry must be made to run the sibr.reply.py script. An interval somewhere between 1 and 5 minutes is suggested, and the edited crontab example below shows the script being run every three minutes:

MAILTO=postmaster@yourdomain.com
HOME=/Users/xadmin
PATH=/bin:/sbin:/usr/bin:/usr/sbin
SHELL=/bin/zsh
#
# mi   hour  mday  month  wday  command
# Check for auto-replies every 3 minutes, except late @ nite
*/3    4-20  *     *      *     /usr/share/sibr.reply/reply.py
# Need to occassionally flush out one of sibr.reply's databases
# MAKE SURE THIS DOESN'T RUN AT THE SAME TIME AS REPLY.PY!
02     00    *     *      6     /bin/rm /var/sibr.reply/SenderDates.db

How do I use it?

All interaction with the system is normally done via email messages sent to the autoreply account.

Turning on an auto-reply

Send a message with the subject of "on" (without the quotes) and the autoreply message in in the body of the email. The message must be sent by the account that the auto-reply should be activated with. If the body of the message is empty then a default message will be used. After sending your autoreply activation message the user should receive an email acknowledging that autoreply has been turned on.

An example of what an activation message looks like is below:

To: autoreply@yourdomain.com
Subject: on

I'm going to be out of the office for a while. Please contact one of my co-workers in my absence.

Thank You,
John Doe

Turning off an auto-reply

Send a message with a subject containing only the word "off".

After the request has been processed, you should receive an emailed confirmation that the auto-reply has been turned off.

If the script finds something other than "on" or "off" in the subject a usage message is sent to the user. The default message looks like this:

Subject: Error processing your autoreply request
From: autoreply@yourdomain.com
Precedence: bulk

The command you sent could not be processed. Please follow the directions below on how to activate, or turn off, your autoreply message.

*** Turning Auto-reply On ***

Reply to this message with a subject of "on" (without quotes), and enter your autoreply message in in the body of the email. If the body of the message is empty then a default message will be used. After sending your autoreply activation message you should receive an email acknowledging that your autoreply has been turned on.

An example of what an activation message looks like is below:

------

To: autoreply@yourdomain.com
Subject: on

I'm going to be out of the office for a while. Please contact one of my co-workers in my absence.

Thank You,
John Doe

------


*** Turn Auto-reply Off ***

Send a message with a subject containing only the word "off".

After the message has been processed you should receive an emailed confirmation that your auto-reply has been turned off.

What are the requirements for this program?

This program has been tested on Mac OS Server 10.4.x, with some testing done on 10.3.9.

Limitations

This script will only work for a single domain. Auto-replies always use the subject "Autoreply", although some may see this as a feature, since some systems receiving the auto-replies may use the subject when looking for auto-reply messages. It only sends out plain-text replies, and will sometimes have non-fatal problems parsing formatted (HTML) auto-reply activations messages into plain-text auto-reply messages.


Download sibr.reply.zip