fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] exit with non zero code, 2nd

2002-09-15 00:51:22
Quoting from Matthias Andree's mail on Fri, Sep 13, 2002 at 01:33:11PM +0200:
I think the mda is supposed to send the bouncemail on its own anyway.

The MDA MUST NOT send mail. Its only task is to deliver the mail it is
passed, exit 0, or fail and exit non-zero. The MTA then generates the
bounce.

I was not aware of these nuances in MDA and MTA. Then, my previous
mail would make more sense if you replace "MDA" by "MTA in multidrop
mode".

The fact is that the current MDA option is an MTA option in multidrop
mode. And, so the fact remains that the current MTA (which is
specified through the MDA option) should send the bouncemail. This is
because:

1) multiple recipients are specified on the command line (through %T).
only the MTA can know which addresses have failed and which have not
and send the bouncemail accordingly. The exit status is not sufficient
for fetchmail to get this information to send the bouncemail.

2) the full addresses have been passed in the recipient list. Again,
only an MTA will know the translation between the full address and the
local username.

1. Make fetchmail able to send bounces through /usr/sbin/sendmail.  To
   achieve this, the SMTP-sending code should be put into its own
   capsule and decoupled from regular mail routing or bouncing. We could
   also have a look at:

   - Brian Stafford's libESMTP (LGPL license)
   http://www.stafford.uklinux.net/libesmtp/ or

   - Jef Poskanzer's mini_sendmail (X11 license IIRC)
   http://www.acme.com/software/mini_sendmail/ (but I'm unsure how this
   must be adjusted).

2. Weed -oem and -OErrorMode=m options from any externally-called
   programs should the user add this option, to extinct double bounce risk.

3. Make fetchmail bounce when the MDA fails.

4. Consider if we need to rename the MDA option to MTA (as it can also
   send bounces at that future time), and add a new MDA option that only
   really works with a real MDA.

The following points will have to be kept in mind while implementing
this:

1) the MDA will have to be invoked for each recipient in multidrop
mode. I propose that an option %U (for local username) be used for
this.

Thus, if %U exists in the MDA line, invoke the MDA for each recipient,
record the exit status. if the exit status is valid and indicates an
error, send the bounce.

However, if %T exists in the MDA line (the current scenario), then the
MDA is actually an MTA. invoke the MTA for all recipients. if the exit
status is valid, ignore the exit status, and do not send any bounce.

(neither %T nor %U specified? a misconfiguration!)

(In single-drop mode, %T should be converted to %U for backward
compatibility)

Note that only a limited set of exit statuses can be accepted as
valid. From <sysexits.h>, if the exit status is not EX_OK and not
between EX__BASE and EX__MAX, then return a transient error instead.

2) fetchmail will have to do the translation of the full recipient
address to the local username (for MDA with %U only). This is because
most MDAs (like procmail) will not understand the full email address.

Sunil Shetye.