[erlang-questions] Sending email

Geoff Cant <>
Wed Apr 29 02:35:28 CEST 2009


Mark Selby <> writes:

> I'm rebuilding a Rails app in Webmachine and need to send email via 
> Gmail, all correctly configured for the domain in question.
>
> Is erlmail the only way to go with this, or are there better options?

I got tired of not having an answer to the email sending problem and
developed esmtp (http://github.com/archaelus/esmtp) as a result.

In my use of esmtp I assume a local smarthost, so I haven't used it with
gmail before. I've checked the code and it does support auth, but not
ssl yet. Adding ssl is probably not too tricky... (2 hours pass)... so
I've just done it:

application:load(esmtp),
application:set_env(esmtp, smarthost, {"smtp.gmail.com",465}),
application:set_env(esmtp, login,
{"","YourPassword"}),
application:start(esmtp).

(The above is to set the config parameters without a config file).

esmtp:send(esmtp_mime:msg("<>","<>","Some
Subject", "Some Body")).

I'll probably need to check to see I haven't broken regular smtp in this
update. And make the error reporting better. And document this properly.

I couldn't get TLS work properly in R13B, but I'll track that down some
other time.

Cheers,
-- 
Geoff Cant




More information about the erlang-questions mailing list