Qpsmtpd::DSN(3pm)
โจ Qpsmtpd::DSN โ Enhanced Mail System Status Codes, RFC 1893 โจ
okay bestie, this is the Qpsmtpd::DSN page from the User Contributed Perl Documentation (that's the 3pm vibe, iykyk) ๐
๐ธ DESCRIPTION ๐ธ
So basically? Qpsmtpd::DSN implements the Enhanced Mail System Status Codes from RFC 1893. That's it, that's the whole concept, and honestly? iconic of it. ๐
๐ USAGE ๐
Every single qpsmtpd plugin can get at these status codes, no gatekeeping here. All the sub routines are called the exact same way, so once you know the pattern you know everything:
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");
Here's the tea on how arguments work โ:
- If you don't hand it a status message, it just uses the predefined one from the RFC. Low maintenance queen.
- If the first argument is numeric, that number gets used as the return code.
- If it isn't, the default return code is used instead.
Not sure which default return code goes with which function? It's all spelled out below, don't worry ๐ซถ
So for the examples up top: the first one returns (DENY, "Relaying denied"). The other two return (DENY, "Relaying from $ip denied"). Either way that's what gets handed back to qpsmtpd. โจ
Also! For all those sub routines that don't start with addr_, sys_, net_, proto_, media_, or sec_, I've added a default message that describes the status better than the plain RFC message does. You're welcome ๐
๐ฌ ADDRESS STATUS ๐ฌ
addr_unspecifiedโX.1.0, default:DENYSOFTno_such_user,addr_bad_dest_mboxโX.1.1, default:DENYaddr_bad_dest_systemโX.1.2, default:DENYaddr_bad_dest_syntaxโX.1.3, default:DENYaddr_dest_ambigousโX.1.4, default:DENYSOFTaddr_rcpt_okโX.1.5, default:OKaddr_mbox_movedโX.1.6, default:DENYaddr_bad_from_syntaxโX.1.7, default:DENYaddr_bad_from_systemโX.1.8, default:DENY
๐ฅ MAILBOX STATUS ๐ฅ
mbox_unspecifiedโX.2.0, default:DENYSOFTmbox_disabledโX.2.1, default:DENYโฆ but the 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.
mbox_fullโX.2.2, default:DENYSOFTmbox_msg_too_longโX.2.3, default:DENYmbox_list_expansion_problemโX.2.4, default:DENYSOFT
๐ฅ๏ธ MAIL SYSTEM STATUS ๐ฅ๏ธ
sys_unspecifiedโX.3.0, default:DENYSOFTsys_disk_fullโX.3.1, default:DENYSOFTsys_not_accepting_mailโX.3.2, default:DENYSOFTsys_not_supportedโ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.
sys_msg_too_bigโX.3.4, defaultDENY
๐ NETWORK AND ROUTING STATUS ๐
net_unspecifiedโX.4.0, default:DENYSOFTnet_directory_server_failed,temp_resolver_failedโX.4.3, default:DENYSOFTnet_system_congestedโX.4.5, default:DENYSOFTnet_routing_loop,too_many_hopsโX.4.6, default:DENY, but the 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.
and likeโฆ why would we want to DENYSOFT something like this?? ๐ญ genuinely asking.
๐ฎ MAIL DELIVERY PROTOCOL STATUS ๐ฎ
proto_unspecifiedโX.5.0, default:DENYSOFTproto_invalid_commandโX.5.1, default:DENYproto_syntax_errorโX.5.2, default:DENYproto_rcpt_list_too_long,too_many_rcptsโX.5.3, default:DENYSOFTproto_invalid_cmd_argsโX.5.4, default:DENYproto_wrong_versionโX.5.5, default:DENYSOFT
๐จ MESSAGE CONTENT OR MESSAGE MEDIA STATUS ๐จ
media_unspecifiedโX.6.0, default:DENYSOFTmedia_unsupportedโX.6.1, default:DENYmedia_conv_prohibitedโX.6.2, default:DENYmedia_conv_unsupportedโX.6.3, default:DENYSOFTmedia_conv_lossyโX.6.4, default:DENYSOFT
๐ SECURITY OR POLICY STATUS ๐
sec_unspecifiedโX.7.0, default:DENYSOFTsec_sender_unauthorized,bad_sender_ip,relaying_deniedโX.7.1, default:DENYsec_list_dest_prohibitedโX.7.2, default:DENYsec_conv_failedโX.7.3, default:DENYsec_feature_unsupportedโX.7.4, default:DENYsec_crypto_failureโX.7.5, default:DENYsec_crypto_algorithm_unsupportedโX.7.6, default:DENYSOFTsec_msg_integrity_failureโX.7.7, default:DENY
and that's the whole page bestie, we ate and left no crumbs ๐
โจ this one's from perl v5.40.1, dated 2025-03-21 โ mwah, ily, go return some status codes ๐ซถ๐
๐ฆ where this page comes from
- debian trixie: qpsmtpd 0.94-8
- ubuntu questing: qpsmtpd 0.94-8
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms