|
|
vacation - Reply to mail automatically using qmail.
The information given here is a modified version of the manpage.
vacation
vacation [-I]
vacation [-s]
vacation [-j] [-n] [-tN] username
vacation automatically replies to incoming mail. This version of vacation has
been specifically tailored for use with a qmail mail transport agent. It
will not function if used with a different mail transport agent.
Preparing to go away on vacation
Run vacation without any command line arguments.
The first time you run vacation, a default reply message will be created in
~/.vacation.msg. If this file already exists, it will not be overwritten.
You'll be given the opportunity to see the contents of this file as well as
the chance to edit it to make your own changes.
Once you are satisfied with the contents of the reply message, you will be
asked if you would like to enable vacation.
If you answer yes, the file ~/.qmail will be backed up and the
original updated to contain the following line followed by the original
contents of the ~/.qmail file.
|preline /usr/local/bin/vacation
If the file ~/.qmail does not exist it will be created. The contents of the
file should be the line above.
These instructions tell the qmail-local mail delivery agent to send an
automatic reply to the sender of the message and to deliver the message to
your default mailbox
NOTE: any filtering or forwarding that is done in normal activity
will be continued while vacation is active.
Answering yes also instructs vacation to initialize the dbm database
file(s). The dbm database file(s) will contain details of who was sent an
automatic reply and when it was sent. If the dbm database file(s) already
exist, the contents will be cleared.
If you answer no when asked if you wish to enable vacation neither
the ~/.qmail file nor the dbm database will be changed or created.
Returning from vacation
Run vacation without any command line arguments.
vacation will display a message saying it is bing used then asks if would
like to disable the vacation.
If you answer yes, the file ~/.qmail will be replaced with the
original version of the file. Then ask if you would like to remove the
~/.qmail.bak file - if you choose yes it will remove the backup of the
~/.qmail file.
vacation will then display the contents of the dbm database, listing the
mail addresses of those who were sent an automatic reply to their mail
while you were away and the date on which the automatic reply was sent.
The dbm database will then be cleared.
If you answer no, the file ~/.qmail will not be reverted and the
contents of the dbm database will remain unchanged.
Processing incoming mail
When not in setup mode, vacation reads an incoming mail message from
standard input and automatically sends a reply message to the sender. The
reply text is taken from ~/.vacation.msg. If this file does not exist, a
default message will be used.
vacation will not generate a reply if any of the following conditions are
met:
- The sender address includes the string -REQUEST@.
- The sender is you.
- The sender's name is any of:
- daemon
- postmaster
- mailer-daemon
- mailer
- root
-
The sender matches any of the mail addresses listed in the optional
files ~/.vacation.aliases and ~/.vacation.noreply. See the FILES
section below for more details on these files.
- There is a Precedence: bulk or Precedence: junk header.
- There is a Mailing-List: header.
- The email is flagged as SPAM by spamassassin. This will only happen
if spamassassin is installed on the system receiving the email.
-
Your mail address, or any address you have listed in the optional
~/.vacation.aliases file does not appear in either the To: or Cc:
headers. This feature can be disabled using the -j option. See the
below for more details on this option.
-
An automatic reply has already been sent to the same address during the
last week. The timeout value may be changed using the -t option. See
the section below for more details on this option.
-
-n was specified on the command line and the user does not have
a ~/.vacation.msg file.
none
If no command line options are provided, vacation will run as an
interactive setup program. vacation checks to see if the ~/.qmail
file exists and is calling vacation. If it is not using vacation or the
file~/.qmail does not exist vacation will assume you wish to enable its
services. If you have a ~/.qmail file calling vacation, it will assume you
wish to disable its services.
-I
Hands free initialization. vacation will create or update your ~/.qmail,
~/.vacation.msg and dbm database files. If any of these files already
exist, their contents will be replaced by the vacation defaults. vacation
will exit after the initialization process, regardless of any other
command line options provided.
-s
Show the contents of the dbm database. The contents will not be cleared and
your ~/.qmail and ~/.vacation.msg files not be changed. vacation will
exit after displaying the contents of the dbm database, regardless of any
other command line options provided.
-j
Do not examine the incoming message To: or Cc: headers to determine if the
message was sent directly to you rather than an alias. Using this option
means that mail sent to an alias of which you are a member may generate an
automatic reply. This option is only useful when specified in the ~/.qmail
file.
-n
Do not generate a reply message if the user's ~/.vacation.msg does not
exist. Updates to the dbm database will still be performed. This option is
for those users who wish to quickly disable vacation by removing their
~/.vacation.msg file. It can also be used at sites where users do not have
shell accounts but can remove their own files via ftp or perhaps a purpose
built web interface.
-tN
Change the interval between repeat replies to the same sender. The default
is 1 week. A trailing s, m, h, d, or w scales the number N to seconds,
minutes, hours, days or weeks respectively. For example, to set the
interval value to 3 days you would specify -t3d. There should be no spaces
between the -t and N. This option is only useful when specified in the
~/.qmail file.
username
Your login name. When vacation sees this argument it will examine standard
input for an incoming mail message. The value of this argument is not
actually used by this implementation of vacation as your login name is
provided by a qmail environment variable. However an argument must be
supplied so that vacation knows when to process incoming mail and when to
provide an interactive setup session. Using your login name for this
argument simply maintains a look and feel similar to the sendmail version
of vacation.
Script Configuration
These settings should only be changed if you know what you are doing,
messing with these can damage either your system or user home directories.
$message_file
Contains the text of the automatic reply message. It should not contain
any From: or To: headers. If the string $SUBJECT appears in
$message_file, it will be replaced with the subject of the original
message. $message_file is defined in get_common_details. The default
message is defined by get_common_details also as the initial value of
$vacation_msg.
$dbm_file
The dbm database file(s) used to store sender mail addresses and time
stamps. The actual name of this file, or files, depends on the
implementation of Perl you have at your site. Possibilities include
~/$dbm_file.pag and ~/$dbm_file.dir or ~/$dbm_file.db. The actual names
are unimportant as Perl deals with them internally. $dbm_file is defined
in get_common_details.
$aliases
This optional file, defined in get_program_details ,contains a list of
mail addresses, one per line. Each address should be a fully qualified
alias for yourself. This file serves two purposes.
-
Unless started with the -j option, vacation examines the incoming
message To: and Cc: headers. If your mail address, or any of the mail
addresses specified in ~/$aliases, match any of the addresses in
these headers, an automatic reply will be generated for the message.
If there is no match, an automatic reply will not be generated. This
restricts vacation to replying to mail explicitly addressed to you or
any of your aliases.
-
The second purpose is to avoid sending an automatic reply to any
incoming mail from yourself or one of your aliases - you already know
you're on vacation!
Lines beginning with a # character and blank lines will be ignored.
$noreply
This file, defined in get_program_details ,contains a list of mail
addresses, one per line. If an incoming mail message matches one of the
listed addresses, an automatic reply will not be generated for that
message. The addresses need not be fully qualified. If you will be
sending yourself mail from a remote site, you may wish to include your
remote address to avoid sending yourself an automatic reply.
Lines beginning with a # character and blank lines will be ignored.
$dot_qmail_file
This file, defined in get_user_details, contains the delivery
instructions for the local mail delivery agent, qmail-local.
$pager
This variable, defined in get_user_details, determines what page viewer
program to use to view $message_file and the contents of the dbm database
when dumped. See Environmental Configuration bellow for more
information.
$editor
This variable, defined in get_user_details, determines what editor to use
when modifying $message_file. See Environmental Configuration
bellow for more information.
$vacation
This variable, defined in get_user_details, tells the vacation program
where it is located. This is used to update the $dot_qmail_file.
Environment Configuration
If the environment variable $VISUAL is set and is not null, its value
determines the editor used to edit the ~/.vacation.msg. If $VISUAL is not
set or its value is null, the environment variable $EDITOR is examined. If
it is set and is not null, its value determines the editor to be used. If
$EDITOR is not set or its value is null, the default editor vi will be
used.
If the environment variable $PAGER is set and is not null, its value
determines the page viewing program to be used to display the
~/.vacation.msg and the contents of the dbm database. If it is not set or
its value is null, the default page viewer $pager will be used.
Origionaly written by Peter Samuel (2001/05/09)
peter@uniq.com.au
Origional vearion available here
Modified and released under GPL with permission
Copyright (C) 2003 Aaron Thompson
thompson@cns.uni.edu
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA. or visit
http://www.gnu.org/copyleft/gpl.html
Click here to view the source code online
Click here to download the script
|