Postfixadmin autoreply / out of office on REDHAT / Centos

Requirement :

# Requirements – the following perl modules are required:
# DBD::Pg or DBD::mysql
# Mail::Sender, Email::Valid MIME::Charset, Log::Log4perl, Log::Dispatch, MIME::EncWords and GetOpt::Std

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

cd /var/www/postfixadmin/VIRTUAL_VACATION
cp vacation.pl /var/spool/vacation/vacation.pl
chown -R vacation:vacation /var/spool/vacation
sudo chmod -R 700 /var/spool/vacation

nano /var/spool/vacation/vacation.pl

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

our $vacation_domain = ‘autoreply.yourdomain.com’;

cd /var/www/postfixadmin

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}

nano main.cf

transport_maps = hash:/etc/postfix/transport

nano transport

autoreply.yourdomain.com vacation

postmap /etc/postfix/transport

/etc/init.d/postfix reload

Done. B)

This article was written by matn0t.