Module gen_smtp_client

A simple SMTP client used for sending mail - assumes relaying via a smarthost.

Description

A simple SMTP client used for sending mail - assumes relaying via a smarthost.

Data Types

email()

email() = {string() | binary(), [string() | binary(), ...], string() | binary() | function()}

smtp_client_socket()

abstract datatype: smtp_client_socket()

Function Index

close/1Close an open smtp client socket opened with open/1.
deliver/2Deliver an email on an open smtp client socket.
open/1Open a SMTP client socket with the provided options Once the socket has been opened, you can use it with deliver/2.
send/2Send an email in a non-blocking fashion via a spawned_linked process.
send/3Send an email nonblocking and invoke a callback with the result of the send.
send_blocking/2Send an email and block waiting for the reply.

Function Details

close/1

close(Socker::smtp_client_socket()) -> ok

Close an open smtp client socket opened with open/1.

deliver/2

deliver(Socket::smtp_client_socket(), Email::email()) -> {ok, Receipt::binary()} | {error, any()}

Deliver an email on an open smtp client socket. For use with a socket opened with open/1. The socket can be reused as long as the previous call to deliver/2 returned {ok, Receipt}.

open/1

open(Options::list()) -> {ok, SocketDescriptor::smtp_client_socket()} | {error, any()}

Open a SMTP client socket with the provided options Once the socket has been opened, you can use it with deliver/2.

send/2

send(Email::email(), Options::list()) -> {ok, pid()} | {error, any()}

Send an email in a non-blocking fashion via a spawned_linked process. The process will exit abnormally on a send failure.

send/3

send(Email::email(), Options::list(), Callback::function() | undefined) -> {ok, pid()} | {error, any()}

Send an email nonblocking and invoke a callback with the result of the send. The callback will receive either {ok, Receipt} where Receipt is the SMTP server's receipt identifier, {error, Type, Message} or {exit, ExitReason}, as the single argument.

send_blocking/2

send_blocking(Email::email(), Options::list()) -> binary() | {error, atom(), any()} | {error, any()}

Send an email and block waiting for the reply. Returns either a binary that contains the SMTP server's receipt or {error, Type, Message} or {error, Reason}.


Generated by EDoc