Posts Tagged vacation message

Vacation Option with PostfixAdmin

Posted by Filed Under Postfixadmin with 1 Comment

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.

Vacation Message for Postfix

Posted by Filed Under Filters with Comments Off

The vacation program is not built specifically for Postfix.  So you will need to set it up separately from Postfix and then integrate it. The vacation feature allows you to configure a message that will be returned to the sender when you are out of the office.  If you are using a CentOS version you will not find vacation in any repositories so you will have to compile it, which is not too difficult.

# yum install gdbm-devel
# cd /usr/local/src/
# wget http://internap.dl.sourceforge.net/sourceforge/vacation/vacation-1.2.7.0.tar.gz
# tar -xvzf vacation*
# cd vacation-1.2.7.0
By default it will want to place the man pages in a different localtion so it may be easier just too create the necessary folders and be done with it.
# mkdir /usr/man
# mkdir /usr/man/man1
# make
# make install
The result will be that the binary will be placed in /usr/bin/vacation.

For each user, they must be local users, not virtual users, create a “.vacation.msg” file that looks something like this:
Subject: Out of the Office

I am out of the office until December 14.  I will contact you as soon as I return.

This file must be placed in the user’s home directory.

You must also create a “.forward” file in the user’s home.  The format should look like this:

\myuser, “|/usr/bin/vacation  myuser”

Be sure to replace “myuser” with the real username.

That should make it all work so that when you send a message to the user who is out of the office, Postfix will  return the message in the vacation file.