Simple SMTP client and server written in Erlang.
The SMTP client is very simple, but is capable of sending e-mail via a standard SMTP server. If something unexpected happens, the entire e-mail transaction is aborted.
The SMTP server is likewise trivial, and does not constitute a full-fledged mail server. A specified callback function is called for each piece of incoming mail received.
This module was previously called smtpe
.
client/9 | Called by send_email/1 . |
send_email/1 | Sends an e-mail message to an SMTP server. |
server/1 | Starts a simple SMTP server. |
server/4 | Called by server/1 . |
client(Socket::socket(), Parent::pid(), Originator::string(), Sender::string(), Recipients::[string()], Message::string(), MessageID::string(), Headers::[string()], Subject::string()) -> exit
Called by send_email/1
. Should not be called directly by user code.
Sends an e-mail message to an SMTP server. Options include:
{host, string()}
the name of the host that the SMTP server is running on.
{port, string()}
the port on the host that is running the SMTP service, if not 25.
{originator, string()}
the name of the host that is originating the transaction (i.e., this host.)
{sender, string()}
the e-mail address of the message sender.
{recipients, [string()]}
the e-mail addresses of the message recipients.
{subject, string()}
the subject of the message.
{headers, [string()]}
custom e-mail headers in the form "Header: value"
,
one header per string.
{message, [string()]}
the body of the e-mail message to send, one line per string.
server(Options::[option()]) -> {ok, Pid} | {error, Reason}
Starts a simple SMTP server. Options include:
{host, string()}
the name of the host that the SMTP server shall run on, i.e. the name of this computer.
{port, string()}
the port on the host that shall run the SMTP service, if not 25.
{handler, {module(), function()}}
the handler which is called whenever the server receives a valid
incoming mail message. The specified function (/3
)
is called with the reverse-path (FROM), a list of recipients (RCPT),
and a list of strings (DATA).
server(Socket::socket(), Host::string(), Module::atom(), Function::atom()) -> never_returns
Called by server/1
. Should not be called directly by user code.
Generated by EDoc, Feb 18 2008, 06:48:04.