Setup Vacation on Postfixadmin 3.2 Centos 7.x

in #postfixadmin6 years ago (edited)

This year we set up a new server with Postfixadmin 3.2 and I recently also had to set the vacation module.
I want to outline how I've solved the problem that appears on setup.

  1. Install perl library dependancies:
yum install perl-Email-Valid perl-Email-Sender perl-Email-Simple perl-Test-Email perl-Try-Tiny perl-MIME-Charset perl-MIME-EncWords perl-Log-Log4perl perl-Log-Dispatch perl-Test-mysqld
For Debian:
apt-get installlibmail-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
2. Add user and group, crete folder. groupadd -r -g 65501 vacation useradd -r -u 65501 -g vacation -d /var/spool/vacation -s /sbin/nologin vacation

mkdir /var/spool/vacation
cp /var/www/html/postfixadmin/VIRTUAL_VACATION/vacation.pl /var/spool/vacation
chown -R vacation:vacation /var/spool/vacation

chmod -R 750 /var/spool/vacation/vacation.pl

  1. Setup script.

vim /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’;

close file with :wq

Setup config.local.php
vim /var/www/html/postfixadmin/config.local.php

$CONF['vacation'] = ‘YES’; $CONF['vacation_domain'] = ‘autoreply.yourdomain.com’;
4. Config vacation in postfix
vim /etc/postfix/master.cf
add:
vacation unix - n n - - pipe flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
( do not forget to add some space in front "flags=..... " )

Make sure you have this line in /etc/postfix/main.cf

transport_maps = hash:/etc/postfix/transport

vim /etc/postfix/transport
autoreply.domain.org vacation:

Save file and close. After this:

postmap /etc/postfix/transport
Restart Postfix
systemctl restart postfix.service.
Follow these steps if you get an error in logs like this:

Aug 20 14:25:01 mail postfix/pipe[24086]: 43AF03E0B63: to=<lucian#[email protected]>, orig_to=<[email protected]>, relay=vacation, delay=2, delays=1.4/0.01/0/0.56, dsn=5.3.0, status
=bounced (Command died with status 255: "/var/spool/vacation/vacation.pl". Command output: Attribute (ssl) does not pass the type constraint because: Validation failed for 'Bool' with value "starttls" at
constructor Email::Sender::Transport::SMTP::new (defined at /usr/share/perl5/vendor_perl/Email/Sender/Transport/SMTP.pm line 200) line 98, <STDIN> line 38. Email::Sender::Transport::SMTP::new('Email::Sen
der::Transport::SMTP', 'HASH(0x433e128)') called at /var/spool/vacation/vacation.pl line 474 main::send_vacation_email('[email protected]', '[email protected]', '[email protected]', '<b2f160c
[email protected]>', 456, 0) called at /var/spool/vacation/vacation.pl line 657 )

Solution:

vim /var/spool/vacation/vacation.pl

and change

our $smtp_ssl = 'ssl'
with
our $smtp_ssl = '0'


Posted from my blog with SteemPress : http://blog.ceae.info/setup-vacation-on-postfixadmin-3-2-centos-7-x/

Coin Marketplace

STEEM 0.22
TRX 0.20
JST 0.035
BTC 96819.43
ETH 3313.98
USDT 1.00
SBD 3.13