DOKK / manpages / debian 12 / qpsmtpd / Qpsmtpd::DSN.3pm.en
Qpsmtpd::DSN(3pm) User Contributed Perl Documentation Qpsmtpd::DSN(3pm)

Qpsmtpd::DSN - Enhanced Mail System Status Codes - RFC 1893

The Qpsmtpd::DSN implements the Enhanced Mail System Status Codes from RFC 1893.

Any qpsmtpd plugin can access these status codes. All sub routines are used the same way:
use Qpsmtpd::DSN;
...;
return Qpsmtpd::DSN->relaying_denied();

or

 return Qpsmtpd::DSN->relaying_denied("Relaying from $ip denied");

or

 return Qpsmtpd::DSN->relaying_denied(DENY,"Relaying from $ip denied");

If no status message was given, it will use the predefined one from the RFC. If the first argument is numeric, it will use this as a return code, else the default return code is used. See below which default return code is used in the different functions.

The first example will return (DENY, "Relaying denied"); the others (DENY, "Relaying from $ip denied"); which will be returned to qpsmtpd.

In those sub routines which don't start with addr_, sys_, net_, proto_, media_, sec_ I've added a default message which describes the status better than the RFC message.

X.1.0 default: DENYSOFT
X.1.1 default: DENY
X.1.2 default: DENY
X.1.3 default: DENY
X.1.4 default: DENYSOFT
X.1.5 default: OK
X.1.6 default: DENY
X.1.7 default: DENY
X.1.8 default: DENY

X.2.0 default: DENYSOFT
X.2.1 default: DENY ...but RFC says:
The mailbox exists, but is not accepting messages. This may
be a permanent error if the mailbox will never be re-enabled
or a transient error if the mailbox is only temporarily
disabled.
X.2.2 default: DENYSOFT
X.2.3 default: DENY
X.2.4 default: DENYSOFT

X.3.0 default: DENYSOFT
X.3.1 default: DENYSOFT
X.3.2 default: DENYSOFT
X.3.3 default: DENYSOFT
Selected features specified for the message are not
supported by the destination system. This can occur in
gateways when features from one domain cannot be mapped onto
the supported feature in another.
X.3.4 default DENY

X.4.0 default: DENYSOFT
X.4.3 default: DENYSOFT
X.4.5 default: DENYSOFT
X.4.6 default: DENY, but RFC says:
A routing loop caused the message to be forwarded too many
times, either because of incorrect routing tables or a user
forwarding loop. This is useful only as a persistent
transient error.

Why do we want to DENYSOFT something like this?

X.5.0 default: DENYSOFT
X.5.1 default: DENY
X.5.2 default: DENY
X.5.3 default: DENYSOFT
X.5.4 default: DENY
X.5.5 default: DENYSOFT

X.6.0 default: DENYSOFT
X.6.1 default: DENY
X.6.2 default: DENY
X.6.3 default: DENYSOFT
X.6.4 default: DENYSOFT

X.7.0 default: DENYSOFT
X.7.1 default: DENY
X.7.2 default: DENY
X.7.3 default: DENY
X.7.4 default: DENY
X.7.5 default: DENY
X.7.6 default: DENYSOFT
X.7.7 default: DENY
2023-02-26 perl v5.36.0