Zurück

How to setup automatic mail answering ?

Setup of vacation

The UNIX public domain program vacation returns a message to the sender of a message telling them that you are currently not reading your mail. The intended use is in a .forward file in your home directory. You may download the newest release for RedHat Linux from http://rpmfind.net/linux/RPM/

For example, your .forward file might have:

\zahn, "|/usr/bin/vacation -a martin.zahn -r 0 zahn"

which would send messages to you (assuming your login name was zahn) and reply to any messages for "martin.zahn" or "zahn".

Available options:

-a alias

Handle messages for alias in the same manner as those received for the user's login name. No message will be sent unless login (or an alias supplied using the -a option) is part of either the "To:'' or "Cc:'' headers of the mail.

-i

Initialize the vacation database files. It should be used before you modify your .forward file.

-r n

Set the reply interval to interval days. The default is one week. An interval of  "0'' means that a reply is sent to each message

The people who have sent you messages are maintained as a hash database in the file .vacation.db in your home directory. Vacation expects a file .vacation.msg, in your home directory, containing a message to be sent back to each sender. It should be an entire message (including headers). For example, it might contain:

From: martin dot zahn at akadia dot ch (Martin Zahn)
Subject: I am on vacation

Sorry, but I cannot read your email message. I am on holiday
Please contact my friends for any issue.

Vacation reads the first line from the standard input for a UNIX "From'' line to determine the sender. Sendmail(8) includes this "From'' line automatically.

Security considerations

The smrsh(8) program is intended as a replacement for /bin/sh in the program mailer definition of sendmail. smrsh is a restricted shell utility that provides the ability to specify, through a configuration, an explicit list of executable programs. When used in conjunction with sendmail, smrsh effectively limits sendmail's scope of program execution to only those programs specified in smrsh's configuration.

You will need to create the directory /etc/smrsh and populate it with the programs that your site feels are allowable for sendmail to execute. This directory is explicitly specified in the source code for smrsh, so changing this directory must be accompanied with a change in smrsh.c.

After creating the /etc/smrsh directory, either copy the programs to the directory, or establish links to the allowable programs from /etc/smrsh. Change the file permissions, so that these programs can not be modified by non-root users. If you use links, you should ensure that the target programs are not modifiable. 

To allow the vacation program by creating a link in the /etc/smrsh directory, you should:

cd /etc/smrsh
ln -s /usr/bin/vacation vacation

After populating the /etc/smrsh directory, you can now configure sendmail to use the restricted shell. Save the current sendmail.cf file prior to modifying it, as a prudent precaution. Typically, the program mailer is defined by a single line in the sendmail configuration file, sendmail.cf. This file is traditionally found in the /etc, /usr/lib or /etc/mail directories, depending on the UNIX vendor.

In order to configure sendmail to use smrsh, you must modify the Mprog definition in the sendmail.cf file, by replacing the /bin/sh specification with /usr/sbin/smrsh.

##################################################
###   Local and Program Mailer specification   ###
##################################################

#####  @(#)local.m4     8.30 (Berkeley) 6/30/1998  #####

Mprog,  P=/usr/sbin/smrsh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
        T=X-Unix,
        A=sh -c $u

Finally you must restart the sendmail daemon.