View Source smtp_socket (gen_smtp v1.2.0)

Facilitates transparent gen_tcp/ssl socket handling

Link to this section Summary

Link to this section Types

Specs

address() :: inet:ip_address() | string() | binary().

Specs

protocol() :: tcp | ssl.

Specs

socket() :: ssl:sslsocket() | gen_tcp:socket().

Link to this section Functions

Specs

accept(Socket :: socket()) -> {ok, socket()} | {error, any()}.

Specs

accept(Socket :: socket(), Timeout :: pos_integer() | infinity) -> {ok, socket()} | {error, any()}.

Specs

active_once(Socket :: socket()) -> ok | {error, any()}.
Link to this function

begin_inet_async(Socket)

View Source

Specs

begin_inet_async(Socket :: socket()) -> any().
{inet_async,...} will be sent to current process when a client connects

Specs

close(Socket :: socket()) -> ok.
Link to this function

connect(Protocol, Address, Port)

View Source

Specs

connect(Protocol :: protocol(), Address :: address(), Port :: pos_integer()) ->
           {ok, socket()} | {error, any()}.
Link to this function

connect(Protocol, Address, Port, Options)

View Source

Specs

connect(Protocol :: protocol(), Address :: address(), Port :: pos_integer(), Options :: list()) ->
           {ok, socket()} | {error, any()}.
Link to this function

connect(Protocol, Address, Port, Options, Time)

View Source

Specs

connect(Protocol :: protocol(),
        Address :: address(),
        Port :: pos_integer(),
        Options :: list(),
        Time :: non_neg_integer() | infinity) ->
           {ok, socket()} | {error, any()}.
Link to this function

controlling_process(Socket, NewOwner)

View Source

Specs

controlling_process(Socket :: socket(), NewOwner :: pid()) -> ok | {error, any()}.
Link to this function

extract_port_from_socket(Socket)

View Source

Specs

extract_port_from_socket(Socket :: socket()) -> port().

Specs

get_proto(Socket :: any()) -> tcp | ssl.
Link to this function

handle_inet_async(Message)

View Source

Specs

handle_inet_async(Message :: {inet_async, socket(), any(), {ok, socket()}}) -> {ok, socket()}.
handle the {inet_async,...} message
Link to this function

handle_inet_async(ListenSocket, ClientSocket)

View Source

Specs

handle_inet_async(ListenSocket :: socket(), ClientSocket :: socket()) -> {ok, socket()}.
Link to this function

handle_inet_async(ListenSocket, ClientSocket, Options)

View Source

Specs

handle_inet_async(ListenSocket :: socket(), ClientSocket :: socket(), Options :: list()) ->
                     {ok, socket()}.

Specs

listen(Protocol :: protocol(), Port :: pos_integer()) -> {ok, socket()} | {error, any()}.
Link to this function

listen(Protocol, Port, Options)

View Source

Specs

listen(Protocol :: protocol(), Port :: pos_integer(), Options :: list()) ->
          {ok, socket()} | {error, any()}.

Specs

peername(Socket :: socket()) -> {ok, {inet:ip_address(), non_neg_integer()}} | {error, any()}.

Specs

recv(Socket :: socket(), Length :: non_neg_integer()) -> {ok, any()} | {error, any()}.
Link to this function

recv(Socket, Length, Timeout)

View Source

Specs

recv(Socket :: socket(), Length :: non_neg_integer(), Timeout :: non_neg_integer() | infinity) ->
        {ok, any()} | {error, any()}.

Specs

send(Socket :: socket(), Data :: binary() | string() | iolist()) -> ok | {error, any()}.
Link to this function

setopts(Socket, Options)

View Source

Specs

setopts(Socket :: socket(), Options :: list()) -> ok | {error, any()}.

Specs

shutdown(Socket :: socket(), How :: read | write | read_write) -> ok | {error, any()}.

Specs

to_ssl_client(Socket :: socket()) -> {ok, ssl:sslsocket()} | {error, already_ssl}.
Link to this function

to_ssl_client(Socket, Options)

View Source

Specs

to_ssl_client(Socket :: socket(), Options :: list()) ->
                 {ok, ssl:sslsocket()} | {error, already_ssl}.
Link to this function

to_ssl_client(Socket, Options, Timeout)

View Source

Specs

to_ssl_client(Socket :: socket(), Options :: list(), Timeout :: non_neg_integer() | infinity) ->
                 {ok, ssl:sslsocket()} | {error, already_ssl}.

Specs

to_ssl_server(Socket :: socket()) -> {ok, ssl:sslsocket()} | {error, any()}.
Upgrade a TCP connection to SSL
Link to this function

to_ssl_server(Socket, Options)

View Source

Specs

to_ssl_server(Socket :: socket(), Options :: list()) -> {ok, ssl:sslsocket()} | {error, any()}.
Link to this function

to_ssl_server(Socket, Options, Timeout)

View Source

Specs

to_ssl_server(Socket :: socket(), Options :: list(), Timeout :: non_neg_integer() | infinity) ->
                 {ok, ssl:sslsocket()} | {error, any()}.

Specs

type(Socket :: socket()) -> protocol().