qmail-autoresponder − Produce automatic responses with qmail
qmail-autoresponder [ −cLNqT ] [ -O NAME[=VALUE] ] [ -n NUM ] [ -s STR ] [ -t TIME ] [ MESSAGE-FILE ] DIRECTORY
qmail-autoresponder sends an automatically-generated message in response to an incoming message. It also tracks the number of responses it sends to each sender in order to limit the rate at which it sends responses, to prevent mail flooding or denial of service attacks. By default, it limits the number of responses it sends to a maximum of one message per hour per sender. It will not respond to any known mailing list, nor will it respond to either bounces or loops.
The MESSAGE-FILE is used as the response message, and must contain a complete mail message including From: and Subject: headers. If the MESSAGE-FILE argument is not present, it defaults to message.txt. All occurrences of %S in the message file are replaced with the original message’s subject, %s with the original message’s sender (to which the response will be sent), and %r with the original message’s recipient. To put a percent sign in the message, write it as %%.
RESPONSE
COUNTING
For each response qmail-autoresponder sends, it
creates a file in DIRECTORY. The name of that file
consists of the current UNIX time number, a period, the
process ID of qmail-autoresponder, a period, and the
envelope sender address (with any / characters
replaced with : to prevent creation of files outside
of DIRECTORY). When it receives a message, it scans
DIRECTORY. Any files that are older than the time
interval (see below) are deleted and ignored. If the number
of remaining files with the same sender address is greater
than or equal to the maximum number of replies, no response
is generated.
LOGGING
If DIRECTORY contains a writeable file named
log.txt, then a line is added to this file each time
a sender is processed. The format of these lines are as
follows:
TIMESTAMP +SENDER TIMESTAMP -SENDER
The first line indicates a message was sent to the sender, and the second that a message was not sent. The timestamp is expressed as standard UNIX time (the number of seconds since Jan 1 1970 GMT).
qmail-autoresponder supports options specified on the command line, in a file named config.txt, and as individual files in DIRECTORY. If config.txt is present, any individual config files are ignored. Option files in the directory (either config.txt or individual files) override options set on the command line.
The config.txt file contains one setting per line, with the option name separated from the value by a =. The value extends from the first character after the = to the end of the line. Lines starting with # are ignored.
The message may also be placed in this configuration file. It is separated from the settings by a single blank line. If present, message.txt is not read for the response message.
For example:
copymsg=1 # Keep all the X-* headers along with the subject. headerkeep=subject:x-* bcc=sendmeacopy@example.com starttime=2018-03-14 15:59:00 subject=This is a very long response subject that does not include the original From: Automatic Responder <recipient@example.com> Subject: Vacation response (%S) This is an automated response to your email...
COMMAND LINE
-c |
Equivalent to -O copymsg=1 | ||
-L |
Create new files (instead of making links) for each recipient file. This uses more inodes, but may be required for filesystems (such as Coda) that don’t handle links properly. | ||
-N |
Write the generated response to standard output instead of sending it. | ||
-n NUM |
Equivalent to -O msglimit=NUM |
-O NAME[=VALUE]
Sets named option NAME to VALUE. If VALUE is omitted, a value of 1 is used. See below for all the named options.
-q |
Quiet. Don’t show error messages. |
|||
-s STR |
Equivalent to -O subject_prefix=STR |
|||
-T |
Do not add a To: <SENDER> line to the response. |
-t TIME
Equivalent to -O timelimit=TIME
NAMED
OPTIONS
bcc (string)
If given, all responses are copied to this address in addition to the original sender.
copymsg (boolean)
Copy the original message into the response.
endtime (string)
Set the ending time for which this autoresponder is active. Messages received after this time will not cause a response to be generated.
headerkeep (string)
If this option is given, only the headers listed in the value are copied from the message into the response. Separate header names with a colon. If neither this nor headerstrip are used, all headers are copied.
headerstrip (string)
If this option is given and headerkeep is not, the headers listed in the value are omitted when copying from the message into the response. Separate header names with a colon. Header names are treated as patterns, and so may contain * to match any string. For example, the pattern x-* will match the headers X-DomainKeys: and X-SpamLevel:.
msglimit (integer)
Set the maximum number of replies per timelimit (defaults to 1).
no_inreplyto (boolean)
Do not add an In-Reply-To: header to the outgoing message. Normally, if a Message-Id: header is found in the original message, qmail-autoresponder will add the contents of that header to the outgoing message. This allows some email programs to group responses more intelligently.
numlines (integer)
Limits the maximum number of lines copied from the original message body into the response. This option is only relevant if the copymsg option is also used. If not given, all the lines in the original message body are copied. This limit does not impact how many lines of the header are copied.
separator (string)
Add a separator line (or lines) between the response message and the copied message.
starttime (string)
Set the starting time for which this autoresponder is active. Messages received before this time will not cause a response to be generated.
subject_prefix (string)
Add a subject line to the response message composed of the prefix STR followed by the original subject. This can also be accomplished by putting the following line at the start of the message file:
Subject: STR %S
timelimit (integer)
Set the interval during which responses are counted (in seconds) (defaults to 1 hour).
Exits zero if there were no problems, otherwise exits 111.
DTLINE |
qmail-autoresponder searches for this line (generated by qmail-local) in the input and bounces the message if it is present (which indicates a mail loop). It then adds the line to the output. | ||
SENDER |
This contains the envelope sender address and is used as the address to send the reply to. |