	
	errormails

------------------------------------------------------------
1	Overview
1.1	errormails
1.2	where error messages comes to
1.3	Automatically remove addresses which causes error. 
1.4	confirmd
1.5	avoid loop

2	MEAD (Mail Error Analyze Daemon)
2.1	Introduction
2.3	files
2.4	Theory
2.5	How to set up mead
2.6	Configuration file
2.7	mead.pl Command Line Option
2.8	Discussion
2.9	A few tips
2.10	VERPs (Variable Envelope Return Paths)

3	qmail VERPs

4	Mail Loops
4.1	Message-ID: Cache
4.2	Unique X-ML-Info: header field

5	Confirmation Daemon (libexec/confirmd.pl)
5.1	Introduction
5.2	Hot to Set Up
5.3	Variables 
5.4	Files
------------------------------------------------------------


1	Overview

See   section for troubleshooting examples.

1.1	errormails

Typical error messages => troubleshoot 6 section

loop => 4 section

1.2	where error messages comes to

"elena-admin" by default. The mail is forwarded to "fml" who ran
makefml in "makefml newml". If you change the forwarding rule,

	elena-admin: fml

1. change elena-admin entry in /etc/aliases

2. If you do "su" always, you can use :include: directive.

	elena-admin: :include:/var/spool/ml/elena/include-admin

The format of /var/spool/ml/elena/include-admin is one address for
each line. Pay attention the permission of include-admin file. It
should be 0644.

1.3	Automatically remove addresses which causes error. 

Example: elena ML. To set up mead

	elena-admin: fukachan

	# MEAD; If you use mead.pl, 
	#elena-admin: fukachan, :include:/var/spool/ml/elena/include-mead

	# elena-admin: fukachan

	# MEAD; If you use mead.pl, 
	elena-admin: fukachan, :include:/var/spool/ml/elena/include-mead

1.4	confirmd

1.5	avoid loop

2	MEAD (Mail Error Analyze Daemon)

[abstract]
set up 			=> 2.5
configuration file 	=> 2.6
command line option	=> 2.7

Beta test phase now.

2.1	Introduction

Mail delivery causes some errors such as "User unknown", ...

Example:
     From:    Mail Delivery Subsystem <MAILER-DAEMON@DOMAIN.OR.JP>
     Subject: Returned mail: User unknown
     To:      xxx-admin@shumi.fml.org
     Date:    Sun, 21 Jun 1998 16:17:22 +0900 (JST)
    
     ... while talking to mail.domain.or.jp.:
     >>> RCPT To:<xyz@ar.domain.or.jp>
     <<< 553 <xyz@ar.domain.or.jp>... User Unknown
     550 xyz@ar.domain.or.jp... User unknown
    ~.q
    
    In default returned error mails are set up to be forwarded to
    $MAINTAINER. See the file $DIR/aliases example file. If you can
    collect error information automatically, you may remove "user unknown"
    user addresses. For example mead.pl collects the information and remove
    an address if the address causes errors over some limit.
    
    This may be dangerous especially when you do mis-configuration. So
    this is not fml default.  But this mechanism is helpful for you in the
    last of year.
    
2.3	files

2.4	Theory

mead.pl caches returned error mails as an input if the error content
has 5XX code which must be critical. If the error limits some
threshold, mead.pl does "notify removing address to $MAINTAINER" or
"call makefml and remove error mail addresses automatically". In
default "notify removing address to $MAINTAINER".

2.5	How to set up mead

"makefml newml" creates a sample

	include-mead

and $DIR/aliases has a sample entry for mead (comment out).
":include:/var/spool/ml/elena/include-mead" is a sample to kick off mead
program for mails forwarded to elena-admin.

Example: elena ML. To set up mead

	elena-admin: fukachan

	# MEAD; If you use mead.pl, 
	#elena-admin: fukachan, :include:/var/spool/ml/elena/include-mead

	# elena-admin: fukachan

	# MEAD; If you use mead.pl, 
	elena-admin: fukachan, :include:/var/spool/ml/elena/include-mead

2.6	Configuration file

"-f configfile" option loads configuration from this file at the first
stage.  Other command line options can overwrite it.  In default
mead.pl does not use the configuration file but use only command line
options.

e.g.
	mead.pl -f /usr/local/fml/mead_config.ph ...

2.7	mead.pl Command Line Option

Usage: mead.pl [options]

Options:
    -h              help
    -d              debug mode on
    -m mode         mode; report or auto ('report' in default).

    -f configfile   load configuration from this file at the first
                    Other command line options can overwrite it.
    -e number       expire of error data cache (unit is 'day')
    -i number       check interval (unit is 'second')

    -C cachefile    mead data cache file
    -D directory    $DIR (mead.pl working directory)
    -E directory    $EXEC_DIR (e.g. /usr/local/fml)
    -S directory    $ML_DIR (e.g. /var/spool/ml)
    -M path         makefml path

    -p priority     priority, e.g. -p uu=2,uh=0.5
                    (user unkwown == 2, host unkown == 0.5)
                    [KEYWORD]
                            uu: unknown user
                            uh: unknown host
                            ua: unknown address
                            us: service unavaiable 
                            default: default value for phrases not above

    -k action        'bye' is default,  off or bye.
                     change the action when mead detects a bad address.

    -l limit         limit whether we should do action defined by '-k action'

    -z sendmail      alternative sendmail path

1998/10/1
   mead.pl -k command option (default 'bye')

If you 'off' the users who causes "unknown user" error "not reachable",
you can  use '-k off' option.

2.8	Discussion

We cannot detect the original address which is forwarded and causes
errors. e.g.

	fml -> a@b.org	-> a@xyz.com (error)

The error mail says for the delivered address <a@b.org>

	 550 <a@xyz.com> user unknown

which is not on $ACTIVE_LIST nor $MEMBER_LIST.

2.9	A few tips

1998/10/10
   mead.pl (Mail Error Analyze Daemon);
	Ignore Japanese Strings (which may cause an error)

2.10	VERPs (Variable Envelope Return Paths)

	http://www.jp.qmail.org/qmaildoc/RFC/RFCVERP.html

VERPs: Variable Envelope Return Paths. See 
http://www.qmail.org/.

If you enable $USE_VERP variable, fml uses VERPs.

	$USE_VERP = 1; (default 0)

    After 2.2C#6 (1999/06/19), I change .qmail-listname-default for VERPs,
    which calls mead.
    
    On "makefml config", you can do
    
       top menu => SECURITY_AND_FILTER => CHECK_MAILBODY_CKSUM => "y"
    
3	qmail VERPs

mead works if you set 

	$USE_VERP = 1;

In "makefml config" menu, 

4	Mail Loops

4.1	Message-ID: Cache

fml check Message-ID: duplication within messages fml receives by
default.  The cache file size is $MESSAGE_ID_CACHE_BUFSIZE (default
60*100) bytes.  The number of cache files is $NEWSYSLOG_MAX + 2.
Approximately fml checks duplication over the past 600 mails.

4.2	Unique X-ML-Info: header field

X-ML-Info: field has the ML address. It must be unique. Mail with
"X-ML-Info: ML" must not be injected to the fml.  Under this
conjecture, we check and reject mails with "X-ML-INfo: our ML".

5	Confirmation Daemon (libexec/confirmd.pl)

This function is implemented after 2.1B#2.

5.1	Introduction

Confirmd periodically queries whether you continue to join this list
or not? If the reply comes within a period (default 2 weeks), confirmd
does nothing (he/she continues to be a member). If not replied,
confirmd removes the member.  When the reply comes, the declaration of
intent has been valid until a period (default 2 months) after
it. After the period, confirmd queries the will of joining this list
again.

Confirmd is executed from cron.pl like a msend.pl (digest).  A crontab
sample generated by "makefml newml" has an entry (commented out) for
confirmd.

5.2	Hot to Set Up

confirmd configuration is commented out in crontab generated by
"makefml newml". Please uncomment it and runs "crontab" command to set
up system cron entries.
Example:

    # confirmd
    # * 5 * * * _EXEC_DIR_/libexec/confirmd.pl _ML_DIR_/_ML_ _EXEC_DIR_

5.3	Variables 

	$CONFIRMD_ACK_EXPIRE_UNIT (2 months in default)

In this period $CONFIRMD_ACK_EXPIRE_UNIT, your reply (the will to join
this list) is effective.  After this period, confirmd queries your
intent again.

	$CONFIRMD_ACK_WAIT_UNIT (2 weeks in default)

After the query is sent, confirmd waits for your reply until
$CONFIRMD_ACK_WAIT_UNIT.

Available representations for the unit time are

	Regular Expression	Example
	------------------------------------
	\d+ month(s)		2 months
	\d+ week(s)		2 weeks
	\d+ day(s)		2 days
	\d+			3600

5.4	Files

	$CONFIRMD_ACK_REQ_FILE ($DIR/confirmd.ackreq)

is a template confirmd uses for the query. 

	$CONFIRMD_ACK_LOGFILE

is the log file of replies.


		INDEX

$CONFIRMD_ACK_LOGFILE                      ...   5.4 
$CONFIRMD_ACK_REQ_FILE                     ...   5.4 
