JackDanger / gen_smtp forked from Vagabond/gen_smtp

A generic SMTP server and client in Erlang that can be extended via callback modules

This URL has Read+Write access

commit  d036a4d11b6beb665000793a017d25572aa3156e
tree    23b221c91ceb801b93c83b6d86c191dd989c2ca1
parent  686a056e96995c3777681dfeac18721de2859511 parent  55dfb9ab396061326e7a3307d2f1e3368fb5510b
name age message
file .gitignore Mon Jun 01 12:27:45 -0700 2009 Setting it to ignore some OS X stuff. [lordnull]
file README.markdown Fri Sep 04 13:08:55 -0700 2009 Update the readme with a client example [Vagabond]
file Rakefile Thu Aug 27 13:28:36 -0700 2009 Add a rake task to generate cert, don't run TLS... [Vagabond]
directory src/ Loading commit data...
directory tasks/ Thu Aug 27 14:27:51 -0700 2009 tweaks [Vagabond]
directory testdata/
README.markdown

Mission

Provide a generic SMTP server and client framework that can be extended via callback modules in the OTP style. The goal is to make it easy to send and receive email in Erlang without the hassle of POP/IMAP. This is not a true mailserver - although you could build one with it.

The SMTP server/client supports PLAIN, LOGIN, CRAM-MD5 authentication as well as STARTTLS and SSL (port 465).

Also included is a MIME encoder/decoder, sorta according to RFC204{5,6,7}.

Current Participants

  • Andrew Thompson (andrew@hijacked.us)
  • Jack Danger Canty (code@jackcanty.com)a

Example

Here's an example usage of the client:

gen_smtp_client:send({"whatever@test.com", ["andrew@hijacked.us"],
 "Subject: testing\r\nFrom: Andrew Thompson \r\nTo: Some Dude \r\n\r\nThis is the email body"},
  [{relay, "smtp.gmail.com"}, {username, "me@gmail.com"}, {password, "mypassword"}]).

The From and To addresses will be wrapped in <>s if they aren't already, TLS will be auto-negotiated if available (unless you pass {tls, never}) and authentication will by attempted by default since a username/password were specified ({auth, never} overrides this).

If you want to mandate tls or auth, you can pass {tls, always} or {auth, always} as one of the options. You can specify an alternate port with {port, 2525} (default is 25) or you can indicate that the server is listening for SSL connections using {ssl, true} (port defaults to 465 with this option).