public
Description: A generic SMTP server and client in Erlang that can be extended via callback modules
Homepage: opencsm.org
Clone URL: git://github.com/Vagabond/gen_smtp.git
name age message
file .gitignore Mon Jun 01 12:27:45 -0700 2009 Setting it to ignore some OS X stuff. [Micah Warren]
file README.markdown Fri Sep 04 13:08:55 -0700 2009 Update the readme with a client example [Andrew Thompson]
file Rakefile Thu Aug 27 13:28:36 -0700 2009 Add a rake task to generate cert, don't run TLS... [Andrew Thompson]
directory src/ Fri Dec 04 16:21:59 -0800 2009 Fix infinite loop while encoding [Andrew Thompson]
directory tasks/ Thu Aug 27 14:27:51 -0700 2009 tweaks [Andrew Thompson]
directory testdata/ Mon Nov 02 20:25:41 -0800 2009 add a missing testfile [Andrew Thompson]
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).