View Source gen_smtp_server_session behaviour (gen_smtp v1.3.0)
Process representing a SMTP session, extensible via a callback module. This module is implemented as a behaviour that the callback module should implement. To see the details of the required callback functions to provide, please see smtp_server_example.
See also: smtp_server_example.
Link to this section Summary
Callbacks
the 'multiple' reply is only available for LMTP
      Functions
Start a SMTP session linked to the calling process.
Link to this section Types
Specs
error_class() ::
    tcp_closed | tcp_error | ssl_closed | ssl_error | data_rejected | timeout | out_of_order |
    ssl_handshake_error | send_error | setopts_error | data_receive_error.
      Specs
options() ::
    [{callbackoptions, any()} |
     {certfile, file:name_all()} |
     {keyfile, file:name_all()} |
     {allow_bare_newlines, false | ignore | fix | strip} |
     {hostname, inet:hostname()} |
     {protocol, smtp | lmtp} |
     {tls_options, [tls_opt()]}].
      Specs
protocol_message() :: string() | iodata().
Specs
tls_opt() :: ssl:tls_server_option().
Link to this section Callbacks
Specs
Specs
Specs
handle_DATA(From :: binary(), To :: [binary(), ...], Data :: binary(), State :: state()) -> {ok | error, protocol_message(), state()} | {multiple, [{ok | error, protocol_message()}], state()}.
Specs
handle_EHLO(Hostname :: binary(), Extensions :: list(), State :: state()) -> {ok, list(), state()} | error_message().
Specs
handle_HELO(Hostname :: binary(), State :: state()) -> {ok, pos_integer() | infinity, state()} | {ok, state()} | error_message().
Specs
Specs
Specs
Specs
Specs
Specs
Specs
Specs
handle_error(error_class(), any(), state()) -> {ok, state()} | {stop, Reason :: any(), state()}.
Specs
Specs
Specs
init(Hostname :: inet:hostname(), _SessionCount, Peername :: inet:ip_address(), Opts :: any()) -> {ok, Banner :: iodata(), CallbackState :: state()} | {stop, Reason :: any(), Message :: iodata()} | ignore.