Behaviours: gen_server.
listener() = #listener{hostname = list(), port = port(), sessionoptions = [tuple()], socket = port() | any(), listenoptions = [tuple()]}
options() = [{domain, string()} | {address, {pos_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()}} | {port, pos_integer()} | {protocol, tcp | ssl} | {sessionoptions, [any()]}]
| init/1 | The gen_smtp_server is given a list of tcp listener configurations. |
| sessions/1 | Return the list of active SMTP session pids. |
| start/1 | Start the listener with callback module Module with default options linked to no process. |
| start/2 | Start the listener with callback module Module with options Options linked to no process. |
| start/3 | Start the listener as a registered process with callback module Module with options Options linked to no process. |
| start_link/1 | Start the listener with callback module Module with default options linked to the calling process. |
| start_link/2 | Start the listener with callback module Module on with options Options linked to the calling process. |
| start_link/3 | Start the listener as a registered process with callback module Module on with options Options linked to the calling process. |
| stop/1 | Stop the listener pid() Pid with reason normal. |
init(Args::list()) -> {ok, #state{listeners = [listener()], module = atom(), sessions = [pid()]}} | {stop, any()}
The gen_smtp_server is given a list of tcp listener configurations. You'll typically only want to listen on one port so your options will be a single-item list containing a proplist. e.g.:
[[{port,25},{protocol,tcp},{domain,"myserver.com"},{address,,{0,0,0,0}}]]
By providing additional configurations the server will listen on multiple
ports over either tcp or ssl on any given port. e.g.:
[
[{port,25},{protocol,tcp},{domain,"myserver.com"},{address,{0,0,0,0}}],
[{port,465},{protocol,ssl},{domain,"secure.myserver.com"},{address,{0.0.0.0}}],
[{port, 25},{family, inet6},{domain,"ipv6.myserver.com"},{address,"::"}]
]
Note that the default port to listen on is 2525 because the regular SMTP
ports are privileged and only bindable by root. The default protocol is
tcp, the default listen address is 0.0.0.0 and the default address family
is inet. Anything passed in the sessionoptions option, is passed through
to gen_smtp_server_session.
See also: gen_smtp_server_session.
sessions(Pid::pid()) -> [pid()]
Return the list of active SMTP session pids.
start(Module::atom()) -> {ok, pid()} | ignore | {error, any()}
Start the listener with callback module Module with default options linked to no process.
start(Module::atom(), Options::[options()]) -> {ok, pid()} | ignore | {error, any()}
Start the listener with callback module Module with options Options linked to no process.
start(ServerName::{local, atom()} | {global, any()}, Module::atom(), Options::[options()]) -> {ok, pid()} | ignore | {error, any()}
Start the listener as a registered process with callback module Module with options Options linked to no process.
start_link(Module::atom()) -> {ok, pid()} | ignore | {error, any()}
Start the listener with callback module Module with default options linked to the calling process.
start_link(Module::atom(), Options::[options()]) -> {ok, pid()} | ignore | {error, any()}
Start the listener with callback module Module on with options Options linked to the calling process.
start_link(ServerName::{local, atom()} | {global, any()}, Module::atom(), Options::[options()]) -> {ok, pid()} | ignore | {error, any()}
Start the listener as a registered process with callback module Module on with options Options linked to the calling process.
stop(Pid::pid()) -> ok
Stop the listener pid() Pid with reason normal.
Generated by EDoc