Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NAME
     archivesmtp -- SMTP mail archiver

SYNOPSIS
     archivesmtp [-abdhnv] [-r pidfile] [-t timeout] [-u username] -f filename
		 -p port

DESCRIPTION
     archivesmtp  uses rule based matching to collect local copies of mail pass-
     ing through the MTA (Mail Transfer Agent) using the milter  library  inter-
     face.

     Supported options are as follows:

     -a       Always  store  mail. By default archivesmtp will always allow mail
	      to pass. This option causes mail to be rejected with  a  temporary
	      failure  message	should	something  prevent its storage. Use with
	      care, simply having a rule with a path that is not writable  would
	      result in all messages that match the rule being rejected.

     -b       Detach  from  the  terminal  and	run in the background (daemonise
	      process). This will cause all output to be sent to  /dev/null  and
	      the working directory to be set to /.

     -d       Don't  unlink  local or unix domain sockets prior to attempting to
	      open them, if they exist the open will fail and the  program  will
	      exit  with  an  error.  In  normal operating conditions the socket
	      would be unlinked when the program exits, thus  the  existence  of
	      the  socket  would suggest the program is already running. However
	      the socket could be left behind if the program was unable to  exit
	      cleanly.	*NOTE: When running as root the socket will NEVER be re-
	      moved on exit.

     -f filename
	      Filename of the configuration file to use. For the format of  this
	      file  check the CONFIGURATION section of this man page. This argu-
	      ment is required.

     -h       Help. Prints the usage string and then exits.

     -n       No run. Parses configuration file and prints out	the  rules  that
	      would be created by it, then exits. Useful for testing that a con-
	      figuration file has no syntax errors.

     -p port  Port  to use for communications with MTA, can be of type unix, lo-
	      cal or inet. For example: unix:/var/run/archivesmtp/f1.sock.  This
	      argument is required. *NOTE: If using unix or local socket and the
	      file exists it will be DELETED unless running with the -d option.

     -r pidfile
	      Running  processes  pid will be stored in this file. The path must
	      be readable and writable by the user archivesmtp is running as.

     -t timeout
	      Timeout value for communication between archivesmtp and the MTA in
	      seconds. The default value of 7210 will be used if  this	flag  is
	      not  given  (Note: Zero (0) does NOT mean wait forever, but rather
	      do not wait at all).

     -u username
	      Username to run as. This can only be set by the root user,  it  is
	      recommended that you do NOT run archivesmtp as root.

     -v       Verbose  output  to  stdout. Add multiple v's to increase level of
	      verbosity (currently two is the highest level used).

CONFIGURATION
     The configuration file contains a list of	rules  that  when  matched  will
     cause  the listed actions specified by that rule to be performed. Rules are
     evaluated in the order they appear and evaluation will continue  regardless
     of  the  success  or failure of the previous rule to match, unless Halt was
     given as one of the rules actions.

     Each rule is made up of two parts, the rule body  which  contains	all  the
     conditions  of the rule and is contained between an opening { and closing }
     bracket followed by a list of comma separated actions  to	perform  if  the
     rule matches. The rule is terminated by a semi-colon.

     { rule_body } action_list;

     The rule body consists of one or more conditions which are separated by the
     Or  and And key words. Conditions can also be grouped between opening ( and
     closing ) brackets.

     { condition1 or (condition2 and condition3) }

     Each condition is made up of three values, the field to match against,  the
     part  of  the field to match against and finally the string to match. Valid
     fields are Sender, From or To and the parts that can be matched are  Start,
     End,  Contains  or  Is. The string to match can be quoted and honours back-
     slash \ escapes, if not quoted it is  white  space  delimited.  The  string
     match  will  be  case insensitive except in the case of Sender, since user-
     names are case sensitive while mail addresses are not. All  conditions  may
     be negated using the ! character before them, this includes brackets.

     { Field Part String }

     Fields:

     Sender    The username of the sender from SMTP Auth (or null if not auth'd)

     From      The address given in the From: header of the mail

     To        All recipients of the mail, including To:, Cc: and Bcc:

     Parts:

     Start     Matches string against the start of the field

     End       Matches string against the end of the field

     Contains  Matches string against any part of the field

     Is        Matches if the string and field are the same

     There are also two special conditions that need no part or string:

     Not Matched
	       Matches if no previous rule has matched this mail

     Match All
	       Matches everything

     The  action  list consists of one or more actions separated by commas, each
     action has a type and a single string containing all arguments. The rule is
     terminated after the last action by a semi-colon. There must  be  at  least
     one action.

     action1_type arguments, action2_type arguments;

     Actions:

     Store In  Stores the matching mail to the file specified in the argument

     Add Header
	       Adds  a	header	to  the  matching  mail,  the argument format is
	       "field:value"

     Pipe      Executes the program specified in the argument and pipes the mail
	       data to that programs standard input

     Halt      Flags that should this rule match, no further  matching	will  be
	       performed after processing its actions. Has no arguments.

     Action  arguments	support token substitution. Tokens are in UPPER CASE and
     marked by a % symbol at the start and end. All tokens support the	addition
     of .USER or .DOMAIN to substitute only that part of the address, by default
     they insert the whole address. You may use an unlimited amount of tokens.

     Tokens:

     %%        Inserts a literal % character

     %SENDER%  Inserts the username of the sender if it has been set

     %FROM%    Inserts the address set in the from header

     %TO%      Inserts the FIRST matched address in the to header

     %ALLTO%   This special case token will cause the action it appears in to be
	       performed  once	for every matched address in the to header, sub-
	       stituting a different one each time

     *Note: Both the TO and ALLTO tokens require at least one To condition to be
     tested and matched by the rule they are part of,  otherwise  they	will  be
     empty.

     So an example rule may be as follows:

     {	Sender Starts "bob" Or From Contains "bob" and (To Ends "@domain.com" Or
     To Ends "@other.com") } Store In /home/%SENDER.USER%/mail.mbox, Halt;

     Please take a look at the sample configuration file for more examples.

Authors
     Dancing Fortune Software - http://www.dancingfortune.com

SEE ALSO
     http://www.dancingfortune.com/projects/archivesmtp/

				     1/11/09			  ARCHIVESMTP(8)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=archivesmtp&sektion=8&manpath=FreeBSD+Ports+15.1.quarterly>

home | help