This article describes how to configure a vacation autoresponder in Postfix mail server so email senders can be informed when the recipient is not available.
Installing the Vacation Perl Script

1. Install Postfix Admin. We are not going to actually use Postfix Admin, we are just going to leverage its excellent vacation message infrastructure. You can skip this part if you are actually using Postfix Admin to manage your Postfix mail server.
2. Add the RPMforge repository. The RPMforge repository is needed to install the required modules for the vacation.pl script.
3. Type in the command below to install the required Perl modules.
yum install perl-MIME-EncWords perl-MIME-Charset perl-Email-Valid perl-Mail-Sendmail

4. Create a new user named vacation. Change the Login Shell to /sbin/nologin, this user account should not be used for logging in. Learn how to use the User Manager application here.

5. Type in the commands below to copy vacation.pl to the vacation user home directory.
cd /home/vacation wget www.linuxmail.info/files/vacation.pl chown vacation:vacation vacation.pl chmod 700 vacation.pl
Configuring Postfix


1. Edit the file /etc/postfix/transport and add the line below.
vacation.invalid vacation:Next, type in the command below to convert it to a database file.
postmap /etc/postfix/transport
vacation unix - n n - - pipe flags=Rq user=vacation
argv=/home/vacation/vacation.pl ${recipient} ${original_recipient}
${original_recipient} requires at least Postfix 2.5 but you can remove it if you prefer not to upgrade. It enables vacation.pl to work with aliases like in the example below.| Email (original recipient) | Forwards to (recipient) |
|---|---|
| john@acme.local | johndoe@acme.local |
| jane@acme.local | janedoe@acme.local |


3. Create the file /etc/postfix/mysql-aliases.cf containing the lines below.
host = localhost user = postfix password = your_password dbname = postfix table = alias select_field = goto where_field = address additional_conditions = and active = '1'
user, password, dbname should match your PostfixAdmin settings.
virtual_alias_maps = mysql:/etc/postfix/mysql-aliases.cf transport_maps = hash:/etc/postfix/transport vacation_destination_recipient_limit = 1
If you already have an existing virtual_alias_maps, add the mysql-aliases into the end like the one below.virtual_alias_maps = ldap:/etc/postfix/ldap-groups.cf, mysql:/etc/postfix/mysql-aliases.cf
If adding the vacation domain conflicts with your existing virtual_alias_maps, use recipient_bcc_maps instead and create the file /etc/postfix/mysql-vacation.cf with the lines below.
host = localhost user = postfix password = your_password dbname = postfix table = vacation select_field = email where_field = email additional_conditions = and active = '1' result_format = %u#%d@vacation.invalid

5. Restart the Postfix or MailScanner service if you have installed it. Learn how to start and stop services here.Configuring the Vacation Perl Script

1. Create the file /home/vacation/vacation.conf containing the lines below.
$db_username = 'postfix'; $db_password = 'secret'; $db_name = 'postfix'; $test_mode = 0; 1;
$db_username, $db_password, $db_name should match your PostfixAdmin settings.

2. Install the SquirrelMail Postfix Admin Plugin and set a vacation message and to a user.postmap -q johndoe@acme.local mysql:/etc/postfix/mysql-aliases.cfReplace johndoe@acme.local with the email address where you have configured a vacation message. The output should contain an email address for the vacation.invalid domain.
If you encounter any problems, check the log file at /var/log/maillog.Visit the forum to ask for help or to give a comment.
***
Posted on 7/11/2009 and last updated on 6/6/2010
Filed under Postfix






August 5th, 2009 at 8:08 pm
hi,
i have configured this postfix vacation message.
the configuration in my system is
Postfix
Dovecot
Squirrelmail
Postfix Admin
I got the autoresponse option in options of squirrelmail.
But i afraid that how it works. Am receiving mails even though i configured autoresponse for a user..
Kindly hlp.
Thank you in advance.
August 5th, 2009 at 10:37 pm
Hi Prakash,
That’s how it works, the user will still receive mail even if he configured an auto response so that when he returns, he can read the all mail that was sent he was out.
August 6th, 2009 at 5:30 pm
hi,
Thanks for your reply.
Have the same question, when i configure autoresponse in a user’s mail it should the tell other users that he is out & contact other person by a reply mail. but i dont have such type of auto mails or else. how do other users will know that a user is out of office when they sent a mail to him.
Is there any other way to achieve it..
Kindly help.
Thanks
prakash
August 10th, 2009 at 7:04 pm
hi consultant,
am waiting for your reply.
this postfix vacation message is not working and it is not be useful if it does not respond to the mails for which it is was configured.
Pls help me with this issue..
Or advice me with some other options to replace this.
thanks,
prakash
August 10th, 2009 at 8:49 pm
Hi Prakash,
Sorry, I can’t help you fix this due to the complexity of setting this up. But there’s probably a misconfiguration somewhere.
August 14th, 2009 at 11:31 pm
Hi,
These pages have been a great help in setting up postfix virtual accounts with ldap. However I have been trying to follow your vacation message page and I can’t get it to work. After studying what was happening I can’t quite see how it is supposed to work. To turn the vacation message on and off postfixadmin alters the alias to cause a copy of the inbound email to be replied to. However if you are not using postfixadmin to manage postfix, it doesn’t can’t see any change in alias because the change is made to the sql server.
Have I missed something?
August 15th, 2009 at 9:44 am
Hi Prakash and Phil Whitehead,
Sorry about that, I modified the article and forgot to update it for non-postfixadmin users. Please check the article again.