Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

haraka-dsn

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-dsn

Haraka DSN

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
increased by105.23%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status Code Climate Code Coverage NPM

haraka-dsn

Custom Return Codes

Plugins return constants to Haraka to specify how to respond to clients for a particular hook.

These constants include DENY, DENYSOFT and DENYDISCONNECT which automatically output an appropriate SMTP status code (e.g. 450 temporary failures for DENYSOFT or 550 permanent failures for DENY or DENYDISCONNECT) in the SMTP response sent back to the client along with an optional message text that you return as arguments to the next() function.

The DSN allows a plugin to return RFC compliant extended status codes and allows plugins to override the SMTP status code returned by Haraka.

The DSN module exposes a callable function for each status condition defined in the RFCs. See the References section below for further information and background.

Using the DSN module in your plugin

Load the DSN module by adding the following line to the top of your plugin:

const DSN = require('haraka-dsn')

Then instead of:

next(DENY, 'No such user')

You can call the DSN module and return that in place of optional message argument of next():

next(DENY, DSN.no_such_user())

This will cause Haraka to return the following back to the client:

`550 5.1.1 No such user`

The DSN functions are used like this:

DSN.<function name>([message], [code]);

The function name is required and maps to the list of defined status codes in RFC 3463. All of the available functions are detailed in the table below.

[message] is optional and should contain the message that you would like to be returned to the client, this value can be a string or an array which can contain multiple elements which will cause a multi-line reply to be sent to the client. If a message is not supplied, then the default message for the DSN function is used.

[code] is optional and should be a numeric SMTP status code to be returned to the client.

Available DSN functions

FunctionDefault SMTP Status CodeEnhanced Status CodeDefault Message
Class: Other or Undefined Status X.0.0
unspecified450X.0.0Other undefined status
Class: Addressing Status X.1.X
addr_unspecified450X.1.0Other address status
addr_bad_dest_mailbox550X.1.1Bad destination mailbox address
addr_bad_dest_system550X.1.2Bad destination system address
addr_bad_dest_syntax550X.1.3Bad destination mailbox address syntax
addr_dest_ambigous450X.1.4Destination mailbox address ambiguous
addr_rcpt_ok220X.1.5Destination address valid
addr_mbox_mobed550X.1.6Destination mailbox has moved, No forwarding address
addr_bad_from_syntax550X.1.7Bad sender"s mailbox address syntax
addr_bad_from_system550X.1.8Bad sender"s system address
Class: Mailbox Status X.2.X
mbox_unspecified450X.2.0Other or undefined mailbox status
mbox_disabled550X.2.1Mailbox disabled, not accepting messages
mbox_full450X.2.2Mailbox full
mbox_msg_too_long550X.2.3Message length exceeds administrative limit
mbox_list_expansion_problem450X.2.4Mailing list expansion problem
Class: Mail System Status X.3.X
sys_unspecified450X.3.0Other or undefined mail system status
sys_disk_full450X.3.1Mail system full
sys_not_accepting_mail450X.3.2System not accepting network messages
sys_not_supported450X.3.3System not capable of selected features
sys_msg_too_big550X.3.4Message too big for system
sys_incorrectly_configured450X.3.5System incorrectly configured
Class: Network and Routing Status X.4.X
net_unspecified450X.4.0Other or undefined network or routing status
net_no_answer450X.4.1No answer from host
net_bad_connection450X.4.2Bad connection
net_directory_server_failed450X.4.3Directory server failure
net_unable_to_route550X.4.4Unable to route
net_system_congested450X.4.5Mail system congestion
net_routing_loop550X.4.6Routing loop detected
net_delivery_time_expired550X.4.7Delivery time expired
Class: Mail Delivery Protocol Status X.5.X
proto_unspecified450X.5.0Other or undefined protocol status
proto_invalid_command550X.5.1Invalid command
proto_syntax_error550X.5.2Syntax error
proto_too_many_recipients450X.5.3Too many recipients
proto_invalid_cmd_args550X.5.4Invalid command arguments
proto_wrong_version450X.5.5Wrong protocol version
Class: Message Content or Media Status X.6.X
media_unspecified450X.6.0Other or undefined media error
media_unsupported550X.6.1Media not supported
media_conv_prohibited550X.6.2Conversion required and prohibited
media_conv_unsupported450X.6.3Conversion required but not supported
media_conv_lossy450X.6.4Conversion with loss performed
media_conv_failed450X.6.5Conversion failed
Class: Security or Policy Status X.7.X
sec_unspecified450X.7.0Other or undefined security status
sec_unauthorized550X.7.1Delivery not authorized, message refused
sec_list_expn_prohibited550X.7.2Mailing list expansion prohibited
sec_conv_failed550X.7.3Security conversion required but not possible
sec_feature_unsupported550X.7.4Security features not supported
sec_crypto_failure550X.7.5Cryptographic failure
sec_crypto_algo_unsupported450X.7.6Cryptographic algorithm not supported
sec_msg_integrity_failure550X.7.7Message integrity failure
Convenience functions
no_such_user550X.1.1No such user
temp_resolver_failed450X.4.3Temporary address resolution failure
too_many_hops550X.4.6Too many hops
bad_sender_ip550X.7.1Bad sender IP
relaying_denied550X.7.1Relaying denied

References

Keywords

FAQs

Package last updated on 07 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc