Patch #4368

rdm-mailhandler.rb should provide feedback to the MTA, rather than failing silently

Added by Peter Fern almost 8 years ago. Updated almost 8 years ago.

Status:ClosedStart date:2009-12-09
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:0.9.0

Description

This patch causes the script to return an exit code to the spawning process, adds a message about invalid email addresses (response.code == 422), returns 77 (EX_NOPERM) for 400..499, returns 75 (EX_TEMPFAIL) for 500..599, and returns 1 for all other errors.

I'm not sure if EX_TEMPFAIL is the right thing to do for 5xx errors (or at least for all 5xx errors), but it seemed like a good idea as these are usually transient.

rdm-mailhandler_exitcode.patch Magnifier (1.55 KB) Peter Fern, 2009-12-09 09:52

Associated revisions

Revision 3143
Added by Jean-Philippe Lang almost 8 years ago

Improve rdm-mailhandler exit status (#4368).

History

#1 Updated by Jean-Philippe Lang almost 8 years ago

Is there a particular meaning for the return codes 77 and 75 ?

#2 Updated by Peter Fern almost 8 years ago

Jean-Philippe Lang wrote:

Is there a particular meaning for the return codes 77 and 75 ?

Indeed, they come from sysexits.h, and are used by many MTAs to decide what action is to be taken for processing handler errors returning these codes. The textual representations are fairly self-explanatory, and the actions taken vary depending on MTA and configuration, however for clarity, an excerpt from sysexits.h:

#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry /
#define EX_NOPERM 77 /
permission denied */

So, 75 generally results in the email being re-queued for a later delivery attempt (often there is a re-queue limit, and the mail will eventually bounce), and 77 generally results in emails being bounced immediately with an error description (permission denied).

#3 Updated by Jean-Philippe Lang almost 8 years ago

  • Status changed from New to Closed
  • Target version set to 0.9.0

Patch committed in r3143 with small changes to the messages and 403 response code fixed (was 443 in your patch).
Thanks.

#4 Updated by Peter Fern almost 8 years ago

Whoops, thanks for catching that, and for the commit.

Also available in: Atom PDF