Vacation script that we will be using requires some Perl modules:
apt-get install libmail-sender-perl libdbd-pg-perl libemail-valid-perl libmime-perl liblog-log4perl-perl liblog-dispatch-perl libgetopt-argvfile-perl libmime-charset-perl libmime-encwords-perl
Create user vacation on your system. This user will handle the vacation script and should have minimal privileges:
adduser vacation --no-create-home --disabled-login mkdir /var/spool/vacation
Copy the vacation.pl script (it is distributed with Postfix Admin) and you can find it inside the VIRTUAL_VACATION folder.
cp vacation.pl /var/spool/vacation/ chown -R vacation:vacation /var/spool/vacation/ chmod 700 /var/spool/vacation/vacation.pl
Create a file /etc/postfix/transport
nano /etc/postfix/transport
and paste:
autoreply.example.com vacation:
This is the domain that will be used for passing the mail to the vacation script.
Edit /etc/hosts and add
your-ip-address autoreply.example.com autoreply
Hash the transport map
postmap /etc/postfix/transport
Edit /etc/postfix/main.cf and add
transport_maps = hash:/etc/postfix/transport
Add vacation transport to the /etc/postfix/master.cf
vacation unix - n n - - pipe flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
you also have to edit the amavis transport to add no_address_mappings in the receive_override_options so your transport for amavis should now look like this:
127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
Edit /var/spool/vacation/vacation.pl and change the configuration settings to match your system.
Reload Postfix and you are done
postfix reload
To handle the Vacation using Postfix admin you will also have to edit its config.inc.php file and set
$CONF['vacation'] = 'YES'; $CONF['vacation_domain'] = 'autoreply.example.com';
Copyright © Goran Jurić