Vacation Option with PostfixAdmin

December 23, 2009 Postfixadmin

Install and Configure the Vacation Option
This installation is for Ubuntu 9.10 but should work for just about any Linux distro.  The vacation package is nice in that you can create an automatic message for when you are not available.

You will need to install a number of packages.

sudo apt-get install libmail-sender-perl libdbd-mysql-perl libemail-valid-perl libmime-perl liblog-log4perl-perl liblog-dispatch-perl libgetopt-argvfile-perl libmime-charset-perl libmime-encwords-perl

Install a Perl Module
From the command line install the Mail::Sendmail perl module.

perl -MCPAN -e shell;

Set it up, likely just hitting enter will provide the options you need.  Once it is complete you will have a shell login for installing modules.  Issue this command:

install Mail::Sendmail

Note it is case sensitive and two colons separate the names.  When it is installed issue the “quit” command to return.

groupadd -r -g 65501 vacation
useradd -r -u 65501 -g vacation -d /var/spool/vacation -s /sbin/nologin vacation

cp /usr/share/doc/postfixadmin/VIRTUAL_VACATION/vacation.pl.gz .
gunzip vacation.pl.gz
cp vacation.pl vacation.pl.original
wget http://www200.pair.com/mecham/spam/vacation.2211.patch.txt
patch -p0 < vacation.2211.patch.txt

or

cd /var/www/postfixadmin/VIRTUAL_VACATION
cp vacation.pl /var/spool/vacation/vacation.pl
wget http://www200.pair.com/mecham/spam/vacation.2211.patch.txt
patch -p0 < vacation.2211.patch.txt
chown -R vacation:vacation /var/spool/vacation
chmod -R 700 /var/spool/vacation

Update the vacation script with your settings

nano /var/spool/vacation/vacation.pl

our $db_type = ‘mysql’;
our $db_username = ‘postfix’;
our $db_password = ‘db_passwd’;
our $db_name = ‘postfix’;

our $vacation_domain = ‘autoreply.yourdomain.com’;
Save and close (CTRL + X)

Update the postfixadmin config file

cd /var/www/postfixadmin
sudo nano config.inc.php

$CONF['vacation'] = ‘YES’;
$CONF['vacation_domain'] = ‘autoreply.yourdomain.com’;

cd /etc/postfix
nano master.cf

Add (near the end of the file):
vacation unix – n n – - pipe flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} ${recipient}
Save

nano main.cf

transport_maps = hash:/etc/postfix/transport
Save

Create a virtual file
jane@your_domain.com jane@your_domain.com@autoreply.your_domain.com
tom@your_domain.com tom@your_domain.com@autoreply.your_domain.com

Save

Create (or update) a transport map to handle the redirected email

nano transport

autoreply.your_domain.com vacation
Save

Postfix uses a hashed file to do the lookups, the postmap command creates that file.

postmap /etc/postfix/transport

Reload the postfix config to activate the changes

sudo /etc/init.d/postfix reload

You should now have a working vacation option with Postfix.

Tags: ,

Comments (1)

 

  1. Social comments and analytics for this post…

    This post was mentioned on Friendfeed by Andrew: How to set the vacation option with PostfixAdmin http://bit.ly/740MV1 postfix mailserver…