5.9 The vacation Program

The vacation program provides an easy means to let people know that you are not reading your mail, such as when you are on vacation. It is intended to be run from your ~/.forward file (Section 13.7) with entries in that file that look something like this:

|"/usr/ucb/vacation you"

Here, the first line ensures that you will receive a copy of any incoming message. The second line causes the vacation program to run, which sends a message back to the sender announcing that you are on vacation.

The first step in setting up the vacation program is to initialize its database, usually called ~/.vacation.db. You do this with the -i command-line switch (-I also works):

% /usr/ucb/vacation -i

The ~/.vacation.db database records each sender to whom a vacation reply has been sent, and insures that no sender will receive more than one such message per week.

The second step in setting up the vacation program is to create a reply message file. That file should be called ~/.vacation.msg, and should minimally contain the following information:

From: Your Full Name <you@your.domain>
Subject: I am on vacation
Precedence: bulk

I am on vacation until July 5 and will reply to your email
when I return.

The first three lines show the minimum headers required. The From: shows to whom the recipient of a vacation message should reply. The Subject: header is a courtesy to the recipient and usually says you are on vacation or are away. The Precedence: header is set to bulk to prevent low-priority mail such as this from interfering with more important mail.

There must be a blank line (not an empty looking line with spaces or tabs) between the headers and the body. The body of the message (here with two lines) can be as simple or complex as you desire. It should tell the recipient when to expect to hear from you and indicate that you actually received the message.

Note that if you forget to create a ~/.vacation.msg first, and set up your ~/.forward file ahead of time, mail to you will bounce with the following error:

501 5.3.0 |"/usr/ucb/vacation you"... Cannot open input

The last step in setting up the vacation program is to set up your ~/.forward file as we showed earlier.

Once you are done, immediately have a friend send email to you. You should receive the message, and your friend should receive a reply from you with the contents of the ~/.vacation.msg file as its body. If your friend receives an error or nothing in reply, check the following:

  • Is your home directory owned by you? Is it writable only by you? If either of these is untrue, sendmail may ignore your ~/.forward file.

  • Is your ~/.forward file owned by you and writable only by you? If it is not, sendmail might ignore your ~/.forward file.

  • Does your system use central .forward files? If so, a .forward file in your home directory might not be honored.

  • If you had someone else set up your ~/.vacation.msg file, you might not have permission to read it. If so, mail to you will bounce.

  • Look in your syslog files for other messages. They can be useful in finding a solution.

5.9.1 Build the vacation Program

The vacation program is built by simply changing to the vacation directory and running:

% ./Build

The vacation program requires no special compile-time macros. Once it is built, you install it like this:

% ./Build install

The vacation program is generally installed in the /usr/ucb or /usr/bin directory (or in another directory defined in your devtools/OS file). You can change this location by defining a new directory with the confUBINDIR macro (confUBINDIR) in your m4 build file.

5.9.2 Other Uses for vacation

The vacation program can also be used as a general notification that you are busy, as a way to retire users, and as a way to manage hours. You are too busy to reply promptly

People are sometimes too busy to reply to all the email they get in a prompt fashion, and it is common courtesy to let senders know of the situation. Consider the following .vacation.msg file:

From: Your Full Name <you@your.domain>
Subject: I got your Message
Precedence: bulk

As you know, I often receive over 1,000 messages a week and cannot
reply to each message right away. This automatic reply is just to
reassure you that I receive all messages, and reply to them eventually.

For a plan such as this to work, you should avoid sending this message too often. Consider resetting the default resend interval from a week to a month with the -r command-line switch (-r). Retire users with notification

The vacation program is also useful as a graceful way to retire users while keeping their account open for a while. Consider, for example, the following .vacation.msg file:

From: Full Name <user@your.domain>
Subject: I have moved
Precedence: bulk

Thanks for your email. It has been forwarded to my new address at:


Please update your records to contain this new address.

To complement this message, the user's ~/.forward file could be set up like this:

|"/usr/ucb/vacation user"

After the account is closed, you can fall back to the less graceful method described for the redirect feature (see FEATURE(redirect)). Manage your hours

The ~/.forward file can contain comment lines. Each such line must begin with a # character. For example:

|"/usr/ucb/vacation -m .vacation.msg.weekday you"
#|"/usr/ucb/vacation -m .vacation.msg.weekend you"

Here, the -m command-line switch (-m) is used to specify different message files to use during the week and on weekends. When the third line is commented out of the ~/.forward file, the weekday message will be sent. By commenting out the second line and uncommenting the third, a different message file will be used.

This is a simplified example of a larger approach that can be quite useful. If you frequently go to conferences, for example, you might need a variety of messages depending on how you can be reached at each conference. Or, you might want to maintain a library of messages, each for a different circumstance.

5.9.3 Exclusions and assumptions

The vacation program only replies to mail that is sent to you or one of your aliases as specified by the -a vacation command-line switch (-a). The vacation program only looks for your login name and aliases in the To: and CC: headers. The effect is beneficial because it ensures that only mail to you generates a reply. Mail that you receive addressed to mailing lists, for example, should not generate a reply.

The vacation program will not reply to certain listed senders. That list is hardcoded as:


In addition, it will not reply to any address whose user part ends in -relay, -request, or -owner, nor where the user part starts with owner-.

Sender addresses are looked up in a case-insensitive manner. Thus, neither "uucp" nor "UUCP" will have replies sent to them. The comparison is from the right side, so addresses that end in -request or -relay will not have replies sent to them.

Note that the vacation program will not send replies to mail that arrives with too low a Precedence: header value. Specifically, junk, bulk, and list are ignored, with no reply sent.

5.9.4 The vacation Program's Command-Line Switches

The behavior of the vacation program can be modified with the command-line switches shown in Table 5-8. In the sections that follow we explain each in greater detail.

Table 5-8. vacation command-line switches






Also handle mail for another name



Specify an alternate configuration file



Don't syslog errors



Use a different database file

-i or -I

-i or -I

Initialize the database file


-l (lowercase L)

List the database's contents



Use a different message file



Change the notification interval



Specify the sender in the command line



Ignored for compatibility with Sun's vacation



Don't look up the user in the passwd(5) file



Exclude a list of addresses



Set the sender to <>

    Part I: Build and Install
    Chapter 2. Build and Install sendmail
    Chapter 4. Configure sendmail.cf with m4
    Part II: Administration
    Part III: The Configuration File