-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

Just presenting a brief writeup of my morning exercise with dbmail:

How to provide functionality such as offered by the famous 'vacation' program
when using dbmail.

When you use dbmail as your default destination for a domain it is quite difficult, if at all possible, to use the vacation program or something similar. These programs assume availability of the .forward mechanism. However, if your /etc/postfix/transport
reads:

mydomain   dbmail:

or something similar, the .forward mechanism is not available.

Dbmail does provide auto_reply hooks where you store the reply messages for users in a separate table. Even though that would give us a much more elegant solution, the auto_reply mechanism at present is simply too dumb to use in a real-world situation. The auto_reply mechanism for instance has no memory of addresses it has replied to, which is one of the key features of a well behaved vacation script. You don't want to create mail-loops or massive numbers of auto-reply on those high-traffic mailinglists you're on.

My recipe uses the pipe-forward mechanism in dbmail, together with a special procmail recipe that has all the things we like about 'vacation'. The only caveat is that you will have to (temporarly) activate shell accounts for all the users that require this functionality.

Lets say you want to provide a 'vacation' auto-reply for user jack:

1) make the away-message in /home/jack/.vacation.msg
2) add the procmail recipe in /home/jack/.procmailrc:

- --<cut>--/home/jack/.procmailrc--<cut>--
SHELL=/bin/sh
VERBOSE=yes
LOGFILE=$HOME/procmail.log

:0 Whc: vacation.lock
* !^FROM_DAEMON
* !^X-Loop: $LOGNAME
| formail -rD 8196 .vacation.db

:0 ehc
| ( /usr/bin/formail -rI"Precedence: junk" -A"X-Loop: $LOGNAME" ; cat $HOME/.vacation.msg ) | $SENDMAIL -oi -t

:0:
| dbmail-smtp -u $LOGNAME
- --<cut>--/home/jack/.procmailrc--<cut>--

3) add the forwarding pipe to the aliases table in dbmail:
dbmail-adduser f [EMAIL PROTECTED] "|/usr/bin/procmail -d jack"

That's it. If you want to deactivate the vacation message, simply remove the forwarder:
dbmail-adduser x [EMAIL PROTECTED] "|/usr/bin/procmail -d jack"


Please note:

This setup assumes that your /usr/bin/procmail is installed suid root. This is default in debian installations. To make sure your procmail is suid root simply execute as root:

chown root /usr/bin/procmail
chmod +s /usr/bin/procmail


regards,

- --
~  ________________________________________________________________
~  Paul Stevens                                  mailto:[EMAIL PROTECTED]
~  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
~  The Netherlands________________________________http://www.nfg.nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/KjxE8iITvBH4zTERAmE9AJ4uG9hxCW0LNaEvitSyV2zhJZJVSQCeK1C/
adwpqCTKJ6FnIxztT3+COmA=
=QUTX
-----END PGP SIGNATURE-----


Reply via email to