CS Public Information -- Automatic Response Email

Automatic email response can be used to automatically notify those attempting to contact you at your user@cs.drexel.edu email address that you are out of office for whatever the reason may be. There are a few simple steps to configure auto-response for your email account, and they involve manipulating files and executing commands while logged in to tux.cs.drexel.edu in your home directory. If you need assistance after following this guide, please reach out to ihelp@drexel.edu, and we'll be able to assist you further.

Configuring Automatic Response for Leaving Office

Initialize .vacation.db

The .vacation.db file is a small database that collects the email addresses of those who contact you, as well as the date they contacted you, while you're away. We need to initialize this file first.

After logging into (SSHing to) tux.cs.drexel.edu, while in your home directory, execute the following command:

vacation -i

You can verify that there is now a file named .vacation.db in your home directory by listing it:

ls -l ~/.vacation.db

Create your away message

Now that we have the database in place, we need to create the message that will be used to automatically respond to incoming mail. This file has to be a valid email file, including headers, not simply the body of the email. The sample below is a good starting point, with edits as necessary. Note the $SUBJECT. This gets replaced with the subject of the incoming email being responded to. It is advised to leave the subject of the sample below as-is, so the automated response will be included in the same email thread for clients like Gmail.

With your favorite editor, create your message in your home directory, in a file named .vacation.msg:
vim ~/.vacation.msg
Your message should look something line the following, always including the From: and Subject: lines, editing them (and the body of the email) as you see fit:


From: gmcfoo@cs.drexel.edu
Subject: Re:$SUBJECT

 

This is an automated response.

 

 

Hello,

 

I am on Vacation from DATE to DATE and will not be reading email until I return.

If this is an urgent matter, please contact CONTACT.

I will respond to messages in the order they have been received after my return.

 

Thank you,

NAME

Edit your .forward

The mail server checks the .forward file in your home directory to check where it should send email to as an alternate to placing it in your home directory's Maildir. You will want to back up your current .forward file (if you have one) before making edits to redirect your mail to the /usr/bin/vacation utility.

First, check to see if you have a .forward file:

ls -l ~/.forward

If this file does exist, it is important that you copy it to a backup file. We will use this when you're back in office to restore your previous configuration:

cp ~/.forward ~/.forward.bak

Now that your (potentially) existing .forward file is backed up, we can edit the the old one (or create one for the first time) using your favorite editor:

vim ~/.forward

The file should contain the following, with relevant edits for your email address. Note that gmcfoo should be replaced with your username, not with your full email address. The email address for gmcfoo would be gmcfoo@cs.drexel.edu, and the .forward file for gmcfoo would be as it is below:

\gmcfoo, "|/usr/bin/vacation -r 0 gmcfoo"

This instructs incoming mail to be sent to your CS mail's inbox as well as sending it along to the vacation utility. Additional email addresses can be included here; this is a comma-separated list of forwarding destinations. If you previously used your .forward file, feel free to include those destinations in this file as well. The -r argument is the number of days to wait before sending an autoresponse to a sender who has already sent you a message and gotten an autoresponse sent back to them. The default, without this argument, is one week. An argument of 0 can be used, but this is potentially dangerous, as it can lead to an infinite mail response loop.

Test your setup

Sending yourself an email from an external account and verifying you receive an auto-response is enough to test that the utility is working for you. Once you verify it is working, it is advised you change the -r 0 argument provided in your .forward file to be -r 1 or some other value. Doing so will prevent you from potentially causing an infinite mail loop and spamming your inbox with auto-responses from another automated response address. While unlikely, it is still a risk. You are free to leave this value as -r 0, but know that you might come back to office with a mailbox full of auto-generated spam.

Upon verifying that your auto-response message works and making the change to only automatically respond to senders, at most, once daily, you've successfully configured your out-of-office, automated response.

Disabling your Automated Response

Checking the .vacation.db

When you're back in office, the .vacation.db can give you a short list of who contacted you and when they contacted you. Reading the database can be done with a simple command:

vacation -l

Restoring your .forward

Now that you're back in office, you can relocate your .forward file and restore any previously used configurations. Moving the auto-response .forward to a backup location will help speed the configuration process the next time you're going out-of-office and need to configure your automated response.

mv ~/.forward ~/.forward.away

If you have a previously used .forward file that you backed-up in the configuration of your automated response, you can restore it now:

cp ~/.forward.bak ~/.forward

Optionally, Removing Unused Files

At this point, you can feel free to remove your automated response .vacation.msg message, as well as the backup .forward.bak files. This is completely optional, and simply to remove unwanted clutter in your home directory. They take up negligible space and are hidden by default:

rm ~/.vacation.msg

rm ~/.forward.bak

Additional Information

Additional information concerning the automated response, as well as another set of instructions (in case you'd like another perspective), is available in the manual page for the vacation utility, accessible by the following:

man vacation