Sovite.SMTP.Server (sovite v0.2.0)

Copy Markdown View Source

An SMTP server: a Sovite.Listener whose connections run Sovite.SMTP.Server.Session.

Supports PIPELINING, SIZE, 8BITMIME, ENHANCEDSTATUSCODES, STARTTLS, and AUTH. What happens to messages is decided by a Sovite.SMTP.Server.Handler:

children = [
  {Sovite.SMTP.Server,
   port: 2525,
   hostname: "mx.example.com",
   handler: {MyHandler, []},
   max_connections_per_ip: 10}
]

Options

Listener options (see Sovite.Listener): :port, :ip, :id, :name, :acceptors, :max_connections, :max_connections_per_ip.

TLS options:

  • :tls - :ssl server options (see Sovite.TLS.server_options/1), or a zero-arity function that returns them (or nil) for each new connection, such as one calling Sovite.TLS.CertStore.server_options/1. Without it, or when it returns nil, TLS is not offered.
  • :implicit_tls - start TLS on connect, before the greeting (port 465, RFC 8314). Defaults to false: STARTTLS is offered instead.
  • :tls_handshake_timeout - milliseconds. Defaults to 60 seconds.

All other options are session options, see Sovite.SMTP.Server.Session. :hostname and :handler are required.

A connection refused by a limit gets 421 4.7.0 before it is closed, except with implicit TLS.

Summary

Functions

Starts the server.

Functions

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()

Starts the server.