MREPLY(1) MREPLY(1) 13 April 1994 NAME mreply - mail filter, mailing list server, file server. SYNOPSIS MReply [ -c configfile ] [ -e errfile ] [ -e logfile ] [ -L ] [ address ] DESCRIPTION MReply is a simple mail server that takes action based on commands given to it, typically in incoming mail messages. Possible actions include adding or removing the mailer's address to or from a given list, sending the mailer a file in plaintext or uuencoded form, receive and uudecode/store a file from the mailer, or forwarding the message to another user, a pipe, or a mailbox. Invocation MReply can be invoked in two different ways: + If address is not specified, MReply will consider the first few lines of the input as mail headers, and try to extract the default reply address by parsing these. This way, MReply can be invoked automatically upon arrival of incoming mail messages. If your system uses `sendmail' as the local mail delivery agent, create a publicly readable file named `.forward' in your home directory, containing the following line: |"exec /path/mreply #your-login-name" Be sure to include the double quotes, as well as the pound sign in front of your login name. (Your name should only be a comment, not an argument for MReply; and is needed because of a bug in `sendmail'). + Otherwise, MReply goes into a local mode, and will display a command prompt to standard output. Enter your commands interactively at this prompt; address specifies the default reply address. OPTIONS -c configfile Specify a configuration file other than the default `.mreply.rc'. -e errfile Specify an error output file other than the default `mreply.err'. -l logfile Specify a request log file other than the default `.mreply.log'. Can be overridden by a .logfile specification in the configuration file; see below. - 1 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 -L Use long log file format. Can be overridden by a .logfile specification in the configuration file; see below. USAGE Requests should be given in the body of the message, one per line, using the following syntax: COMMAND [site*][argument ...] [TO|AS address] If site is given, i.e. if the second word contains a `*', it specifies another mail server to which the request will be forwarded. Each site can be declared with a .site specification in the configuration file; see below. A simple `*' without site in front of it will cause the request to be forwarded to ALL other mail servers that this server knows about. If `TO address' or `AS address' is given, address will override any address given in the mail header or on the command line. Built-in commands and their corresponding arguments are: JOIN [list] / SUBSCRIBE [list] Append address to list. If list is not specified, append to the `[DEFAULT]' list, if any. See also the description of the .LIST and .LISTDIR specifications, below. LEAVE [list] / UNSUBSCRIBE [list] Remove address from list. If list is not specified, remove from the `[DEFAULT]' list, if any. REVIEW [list] List all subscribers of list. If list is not specified, list subscribers of the `[DEFAULT]' list, if any. Availibility of this command can be prevented by declaring a list `concealed'; see the description of the .LIST and .LISTDIR specifications below. WHICH [site] Give a list of all the lists to which address is subscribed. If several listnames refer to the same listfile, only the first one will be included in the response. If site (possibly just a `*') is specified, forward the request. CHANGE old-address Change old-address to address in all lists known to this server. SEND [packet [splitsize]] Send packet via e-mail, as plain text or as a uuencoded shell archive. If packet is not specified, send the `[DEFAULT]' packet, if any. The optional second argument splitsize specifies the maximum size (in bytes or kilobytes) per mail message. See also the description of the .PACKET - 2 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 and .PACKETDIR specifications, below. ACCESS [code] Provide a code for a subsequent file submission. See also the description of the .RECEIVEDIR specification, below. TEXT filename Save the rest of the message as plaintext to filename in the directory specified with the .RECEIVEDIR specification and/or the ACCESS command. See below for details. BEGIN mode filename Uudecode the rest of the message to filename in the directory specified with the .RECEIVEDIR specification and/or the ACCESS command. See below for details. The mode should be an octal number describing the permissions of the stored file. HELP [topic] Return some text specified in the configuration file to address. Intended for basic help on syntax, available commands, lists, packets and/or sites, whichever applicable. SERVERINFO [site] Return some information about the site configuration and the current version of MReply to address. If site is specified (see the description of the .SITE and .SERVER specifications, below), forward the request. Examples The following are some examples of legal syntax for commands given to MReply: JOIN announcement AS alice@wonderland.com (Alice) leave notgnu*mailing SEND DNOT 60 TO foo@bar.com (Foo Bar) send info SERVERINFO change foo@obsolete.com to foo@bar.com (Foo Bar) CONFIGURATION The following syntax is available in the configuration file, by default `.mreply.rc' in your home directory. Keywords These are looked up at various points during processing of the request, and determine the behaviour of this particular server. Each keyword specification should occur on a separate line. In cases where several instances of the same keyword occur, the first matching specification is chosen. .SERVICEADDRESS address - 3 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .OWNERADDRESS address Declaration of the address for this service, and its owner. These are used in various contexts, such as in the "X-Loop:" mail header and ServerInfo responses. If not present, MReply will assume "Your Name <username@host>" as both server and owner address. .FORWARD destination .FORWARDALL destination .LOOPEDFORWARD destination .NOFORWARD Forward non-request mails, all mails, looped mails, and no mail, respectively. For these specifications, destination should be preceeded by !, | or >, the following way: .forward ! user@host.domain Forward the mail to another address. .forward | /path/command arguments Forward the mail to a command via '/bin/sh'. .forward > /path1/mbox1 [/path2/mbox2 ...] Forward the mail to the first successfully opened file of the ones specified. If the mailbox name ends with a "/", it is assumed to be a directory, and your login name is appended. For instance, "/usr/spool/mail/, /usr/mail/" is expanded to "/usr/spool/mail/your-name, /usr/mail/your-name". If neither !, | or > is the first character, > is assumed. The following processing takes place: + If no configuration file is found, the mail is forwarded to your regular mailbox in "/usr/spool/mail/,/usr/mail/,mbox". + Otherwise, if the mail has been here before (i.e. contains an appropriate X-loop: header), it is forwarded via the .LOOPEDFORWARD specification, your regular mailbox by default. + Otherwise, if a .FORWARDALL specification is found, all mail is forwarded according to this. + Otherwise, if a .NOFORWARD specification is found, all mail (request or not) is processed, and responded to. + Otherwise, only request mail is processed and responded to, while regular mail is forwarded via .FORWARD; your mailbox by default. - 4 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .LIST listname listfile [modifier...] .LIST listname ! user@host.domain .LIST listname | /path/command arguments .LIST listname > mailbox-file Specification of subscriber lists. In the first case, commands like `SUBSCRIBE listname' or `REVIEW listname' will affect listfile, whose name is absolute (full path) or relative to your home directory. A special case occurs if the first character of the second argument is `!', `|' or `>'. The request will then be forwarded to e.g. another server, or to a mailbox for manual processing, with a syntax similar to that described under the .FORWARD specification above. If listname is `[DEFAULT]', this line applies to commands without any argument, for instance a simple `SUBSCRIBE' or `UNSUBSCRIBE AS user@host.domain'. The following modifiers are available: AUTOMATIC Automatically add the mailer's address to this list, even if no explicit JOIN or SUBSCRIBE command is given. Not valid if the mail is determined to be a `regular' mail. MANUAL Only add mailers who give explicit JOIN / SUBSCRIBE commands. (Default). CONCEALED Do not allow REVIEW commands on this list. REVEALED Allow REVIEW on this list. (Default). It should be noted that many consider it poor `netiquette' to add someone's name to a mailing list unless they ask for it explitictly, particularly if the list carries a lot of traffic. .LISTDIR directory [modifier...] .LISTDIR ! user@host.domain .LISTDIR | /path/command arguments .LISTDIR > mailbox-file In the first case, this is a directory where to look for a filename matching the argument of e.g. a JOIN or LEAVE command, if no matching .LIST specification is found. Note that such lookup will be case sensitive, so the case of the argument has to match the case of the desired filename. Several of these lines will cause MReply to look through all the specified directories, in the order of appearance. All the other lines specify forwarding, with syntax similar to the .FORWARD specification above. Subsequent .LISTDIR specifications will have no effect. .PACKET packetname filename encoding .PACKET packetname ! user@host.domain - 5 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .PACKET packetname | /path/command arguments .PACKET packetname > /path/mailbox Specification of available packets. In the first case, when a SEND packetname command is given, the associated filename (absolute or relative to your home directory) is returned to address; whereas the other lines are syntax for forwarding the request, e.g. to another server, or to a mailbox for manual processing. If packetname is `[DEFAULT]', this line applies to SEND commands without any arguments. The following encodings are available: PLAIN Send the file `as is', i.e. plaintext. (Default) ENCODED Send file as a uuencoded shell archive. .PACKETDIR directory [encoding] .PACKETDIR ! user@host.domain .PACKETDIR | /path/command arguments .PACKETDIR > mailbox-file In the first case, this is a directory where to look for a filename matching the argument of a `SEND argument' command, if no matching .PACKET specification is found. Note that such lookup will be case sensitive, so the case of the argument has to match the case of the desired filename. Several of these lines will cause MReply to look through all the specified directories, in the order of appearance. All the other lines specify forwarding, with syntax similar to the .FORWARD specification above. Subsequent .PACKETDIR specifications will have no effect. .RECEIVEDIR directory [access-code] Directory in which to place files submitted to this server. If access-code is specified, the mailer has to gain access via an `ACCESS access-code' command before being allowed to submit files to this directory. Several directories with different access-codes can be specified. The first valid entry is chosen, therefore a specification without access- code should appear as the last one. File names supplied by the mailer are stripped to the base, so that the files will not appear in any other directory than the one (s)he has gained access to. .SITE siteid address Specify another site to which requests may be forwarded, if the mailer uses a syntax like: COMMAND siteid*[argument ...] [TO|AS address] Note that several requests may be sent in the same mail, if they are being forwarded to the same address. - 6 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .SERVER address If the above syntax is used, but no matching siteid is found, forward the request to address, rather than giving an `IllegalSite' response. (See below). .SETENV variable value Set environment variable variable to value. If value is an empty string, clear the variable. .UNSETENV variable Clear environment variable variable. .LOGFILE filename [logtype] Use filename to log the request, rather than the default `.mreply.log' or any file specified with the `-l logfile' option on the command line. If logtype is specified, it overrides the -L option or the default `short' logging. Valid logtypes are: SHORT Use a one-line log format. LONG Use a multi-line format with more information; useful for debugging during configuration of your system. .PURGEHEADER Header-Field: Delete the mail header specified before forwarding the mail. .INSERTHEADER Header-Field: Text Add a new header before forwarding the mail, if not already existing. Executed after .PURGEHEADER, hence uniqueness can be guaranteed by providing both specifications on the same Header-Field. .ADDHEADER Header-Field: Text Add a new header before forwarding the mail, without checking to see if it already exists. .HEADER Header-Field: Text Specify a header for reply mail, i.e. responses to commands. If no `To:' and `From:' headers are specified, they will be automatically generated. .SIGNATURE [command [argument]] Specify a signature to append to all responses, as well as mails forwarded to anything else than a mailbox. If command and possibly argument is specified, this signature is used only in response to matching command lines. See also the .END statement, below. - 7 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .MESSAGE message-label [argument] Specification of various responses returned to address upon completion of a request. Also valid inside other .MESSAGE, .COMMAND, .LABEL, or .SIGNATURE declarations. Every line that is not initialized with a `.' is included in the response to address. The following message-labels should be specified: If .LIST or .LISTDIR specifications exist: Added, AlreadyAdded, Removed, NotInList, Review, ConcealedList, IllegalList, Which, Changed, NoChange. If .PACKET or .PACKETDIR specifications exist: SendPlain, SendEncoded, IllegalPacket. If .RECEIVEDIR specifications exist: ReceivePlain, ReceiveEncoded, DecodeError, NoAccess. If .SITE is defined, and .SERVER is not: IllegalSite. Always: Help, Unavailable, SyntaxError, EmptyMail. Optional: AutoAdded, Forwarded, Looped, Resent, Header, Signature, ServerError. See also the .END statement, below. .IGNORE message [argument] If no matching `.MESSAGE message' statement can be found, this prevents an error message from being returned to address. Functionally equivalent to `.MESSAGE message', followed immediately by `.END'. .COMMAND command [argument] Start of a user-defined command. Also valid inside other .MESSAGE, .COMMAND, .LABEL, or .MESSAGE declarations. Every line that is not initialized with a `.' is included in the response to address. See also the .END statement, below. .END The end of a .MESSAGE, .COMMAND, or .SIGNATURE specification, or a .LABEL when called via .GOSUB. Neither of these can be nested, so one .END statement may complete several specifications. In the case of .LABEL, subsequently return to the line after the calling .GOSUB statement, if any. .END is automatically assumed when encountering an - 8 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 .ELIF, .ELSE or .ENDIF statement matching an .IF statement prior to the beginning of the .MESSAGE, .COMMAND, .LABEL, or .SIGNATURE, or upon encountering end-of-file. .INCLUDE filename Include the text from filename in the response. Only valid during parsing of .MESSAGE, .COMMAND, or .SIGNATURE specifications. .EXEC command arguments Execute command via `/bin/sh'. Input is taken from the mail message, starting at the current point; standard output is included in the reply to the user; and output sent to standard error is stored in the variable $ERRORMESSAGE. The return status from the program is stored in $RETURNSTATUS. Upon completion, if the mail message is not exhausted, and no .FLUSH command is given, parsing of the remainder of the message will continue. Only valid during parsing of .MESSAGE, .COMMAND, or .SIGNATURE specifications. .FLUSH Eat the rest of the mail message. Useful in certain cases after an .EXEC command. Only valid during parsing of .MESSAGE, .COMMAND, or .SIGNATURE specifications. .LABEL label Label for .GOTO and .GOSUB. Valid at any point in the configuration file, even if inside unsuccessful .IF, .ELIF or .ELSE statements. See also the .END statement, below. .GOTO label .GOSUB label Jump to `.LABEL label', and continue parsing from there. In the case of .GOSUB, return to the current point upon .END, .ENDIF, or end-of-file, as described for the .END statement, above. .IF [NOT] expression .AND [NOT] expression .OR [NOT] expression .ELIF [NOT] expression .ELSE .ENDIF Conditional parsing of the enclosed sections. Conditions are evaluated from left to right (actually top down) without any different priority levels. (However, nested conditions are available). Syntax for expression: - 9 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 TO address True if address exists in any of the To:, Cc:, Apparently-To:, or Resent-To: headers. FROM address True if address exists in any of the Return-Path:, From, Resent-From:, Sender:, X-From:, From: or Reply-To: headers. FILE name CONTAINS string FILE name EQUALS string FILE name EXISTS HEADER Field: CONTAINS string HEADER Field: EQUALS string HEADER Field: EXISTS string CONTAINS string string EQUALS string string EXISTS Each condition has to start on a separate line, and the number of .ENDIF statements has to match the number of .IF's. Substitutions Various substitutions are available in the configuration file, including environment variables, shell command outputs, and some built-in commands. The following is a description of syntax for these. \c If `\' is the last non-white character on the line, include the next line in the declaration. Otherwise, escape character c according to the following: + If c is one of b, t, n, v, f, or r, insert a backspace, horizontal tab, newline, vertical tab, formfeed, or return character, respetively. + Otherwise, insert c `as is', i.e. do not interpret any special meaning of it. For instance, `\\' gives `\', and `\)' gives `)'. ~/ ~user/ Substitute your own home directory, and the home directory of user, respectively. :variable: $variable ${variable} Substitute environment variable variable. The following - 10 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 variables are automatically specified by MReply: USER Username of the process owner, initialized at startup. HOME The process owner's home directory, initialized at startup. PATH The search path for sub-command executions. If not present before invoking MReply, initialized to some basic search-path at that time. ACCESS The access-code supplied via the ACCESS command; initialized to `[DEFAULT]' at startup. SERVICEADDRESS The address of this service, as read from the .SERVICEADDRESS specification in the configuration file at startup. OWNERADDRESS The address of the owner, as read from the .OWNERADDRESS specification in the configuration file at startup. HEADERADDRESS The default reply address, as specified on the shell command line or extracted from the mail header, converted to the form: user@host.domain (Real Name) FULLADDRESS The reply address for this command, as specified with the TO or AS keywords; by default equal to HEADERADDRESS. ADDRESS The user@host.domain part of FULLADDRESS. USERNAME The user part of FULLADDRESS. FULLNAME The Real Name part of FULLADDRESS, or if not given, the user part of it. NAME Generally the first word of FULLNAME. COMMANDLINE The command line currently being processed. - 11 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 COMMAND The first word of COMMANDLINE. ARGUMENTS All arguments for the current command. A substring of COMMANDLINE starting at the second word (after the `*' if site* is specified), and ending before TO, AS, or end-of-line. ARGUMENT The first argument for the current command. Generally equal to the second word, but exceptions may occur if `site*' or `TO|AS address' is specificed. ARGUMENT2 The second argument for the current command. Generally equal to the third word. SITEID The site specified on the command line, if any. PATHNAME The full path of the file associated with a given argument. Initialized after successfully parsing a .LIST, .LISTDIR, .PACKET, PACKETDIR, or .RECEIVEDIR specification, before returning a response to the reply address. FILENAME The base of PATHNAME PARTS The number of e-mails composing a file sent in response to the SEND command. Available for the SendPlain or SendEncoded responses. MESSAGE The response message that is currently being sent, i.e. `Added', `AlreadyAdded', `Removed', etc. ERRORMESSAGE Initialized upon ServerError responses, or whenever an invoked shell command writes to standard error. RETURNSTATUS Initialized upon completion of an invoked shell command; and contains its return value. - 12 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 Environment variables are inherited by invoked sub-shell commands, and are set or cleared with the .SETENV or .UNSETENV commands in the configuration file. $function(arg1, arg2...) Substitute with output from a built-in function. Wherever a numeric argument is required, any non-numeric syntax will produce an error message in the error file. Functions can be nested, so an argument can contain a call to another function. Available functions are: $WORD(string, wordNo[, noOfWords]) Word number wordNo of string. The first word is number 1, however if wordNo is 0 the word is only copied if there are no leading spaces in string. If noOfWords is given, it specifies the number of words to copy; a value of 0 indicates to copy the remainder of the string. $CHAR(string, charNo[, noOfChars]) Character number charNo of string. The first character is number 1. If noOfChars is given, it specifies the number of characters to copy; a value of 0 indicates to copy the remainder of the string. $REPL(string, charNo, noOfChars, newString) Replace noOfChars characters, starting at position charNo of string, with newString. $POS(string, substring) Position of substring within string. The first position is 1; if substring is not found, return `0'. $LEN(string) The length of string. $ADD(n1, n2...) The sum of the numerical arguments n0, n1... The maximum number of arguments is 10. $SUB(n1, n2...) All arguments starting with n2 subtracted from n1. The maximum number of arguments is 10. $UPCASE(string) Convert string to uppercase. $HEADER(Field:) The Field: header of the input mail. - 13 - Formatted: November 14, 2024 MREPLY(1) MREPLY(1) 13 April 1994 `command arguments` $(command arguments) Substitute with the output from command, executed via /bin/sh. Return status is stored in the variable RETURNSTATUS, and any output written to standard error is stored in ERRORMESSAGE. FILES $HOME/.mreply.rc Default configuration file. $HOME/.mreply.log Default log file. $HOME/mreply.err Default error file. /etc/passwd Used to obtain the USER and HOME variables. /usr/spool/mail/$USER, /usr/mail/$USER Default mailbox. /usr/lib/sendmail Used to send or forward mail. /bin/sh Used to interpret sub-command lines. SEE ALSO sh(1), sendmail(8), BUGS There is currently no way of extending a specification over several lines in the configuration file, without at the same time getting one or more NEWLINE characters inserted at the line breaks. In English: If you e.g. want to execute a long command line via .EXEC, the command can become long and ugly also in this file. During processing of a mail message, or even a single command, the configuration is (partly) parsed several times. Therefore, one should not count on evironment variables being un-initialized if they are assigned a value further down in the file. To secure against this, give a .UNSETENV variable statement prior to referencing the variable. There are no known misbehaviors in this version of MReply. If you discover any, please send a mail to the address below. NOTES To receive the newest version, send an e-mail containing a SEND MREPLY command in the body to <tor@netcom.com>, or retreive it via anonymous FTP to ftp.netcom.com in /pub/tor/mreply. A mailing list for future update announcements is available. To subscribe, send a SUBSCRIBE MREPLY command to the same address. AUTHOR Tor Slettnes <tor@netcom.com> - 14 - Formatted: November 14, 2024