[erlang-questions] Erlang SMTP Client?

271 views
Skip to first unread message

David Mercer

unread,
Oct 10, 2011, 12:56:11 PM10/10/11
to erlang-questions

What is the state of the art for sending email from Erlang?  I can google up a couple of results, but (1) I was surprised there is no such module in the standard distribution (that I could find); and (2) among the results, I wasn’t sure which is the current state of the art.

 

Please advise.  Thank-you.

 

David Mercer

 

 

Eric Merritt

unread,
Oct 10, 2011, 1:05:40 PM10/10/11
to David Mercer, erlang-questions
There is an smtp client here that might be useful for you

https://github.com/ericbmerritt/erfc_parsers

> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Andrew Thompson

unread,
Oct 10, 2011, 2:40:15 PM10/10/11
to erlang-q...@erlang.org
On Mon, Oct 10, 2011 at 12:05:40PM -0500, Eric Merritt wrote:
> There is an smtp client here that might be useful for you
>
> https://github.com/ericbmerritt/erfc_parsers
>
All I see in this repo is a CSV parser?

I'm the author and maintainer of (in my biased view) the most complete
SMTP library for erlang, gen_smtp:

https://github.com/Vagabond/gen_smtp

gen_smtp includes both a SMTP client, and a callback framework for
writing SMTP servers. It's part of several other erlang projects now,
including Zotonic and Chicago Boss.

The other alternative worth considering is Geoff's esmtp:

https://github.com/archaelus/esmtp

I'm not aware of any other SMTP clients that are reliable or mature
enough to be considered for serious usage. There's a random smtp fsm
kicking around the internet, but its not maintained and the licensing on
it is uncertain (or its under the GPL, its unclear).

Andrew

Marc Worrell

unread,
Oct 10, 2011, 3:21:24 PM10/10/11
to Andrew Thompson, erlang-q...@erlang.org
Don't be shy, Andrew.  Your library is the best one out there!
And battle tested.

- Marc

Richard Carlsson

unread,
Oct 10, 2011, 4:12:20 PM10/10/11
to David Mercer, erlang-questions
On 10/10/2011 06:56 PM, David Mercer wrote:
> What is the state of the art for sending email from Erlang? I can google
> up a couple of results, but (1) I was surprised there is no such module
> in the standard distribution (that I could find); and (2) among the
> results, I wasn’t sure which is the current state of the art.

If you just want something simple and reliable, going through sendmail
can be a good idea. We've used this library at Klarna for years:

https://github.com/richcarl/sendmail

For local testing, e.g., on a laptop, I can recommend installing
nullmailer as sendmail replacement rather than postfix or exim4
(http://undesigned.org.za/2007/11/22/nullmailer-a-developers-best-friend) if
you're just interested in forwarding mail from the local machine to a
smarthost.

/Richard

David Mercer

unread,
Oct 10, 2011, 5:30:19 PM10/10/11
to Andrew Thompson, erlang-q...@erlang.org
On Monday, October 10, 2011, Andrew Thompson wrote:

> I'm the author and maintainer of (in my biased view) the most complete
> SMTP library for erlang, gen_smtp:
>
> https://github.com/Vagabond/gen_smtp
>
> gen_smtp includes both a SMTP client, and a callback framework for
> writing SMTP servers. It's part of several other erlang projects now,
> including Zotonic and Chicago Boss.

Thanks. That worked fine out of the box. I must admit, I am surprised
there is no SMTP client in the standard distribution. You would think that
would be a fairly common communication protocol...

Thanks, Andrew.

Cheers,

DBM

Eric Merritt

unread,
Oct 10, 2011, 5:34:01 PM10/10/11
to erlang-q...@erlang.org
On Mon, Oct 10, 2011 at 1:40 PM, Andrew Thompson <and...@hijacked.us> wrote:
> On Mon, Oct 10, 2011 at 12:05:40PM -0500, Eric Merritt wrote:
>> There is an smtp client here that might be useful for you
>>
>> https://github.com/ericbmerritt/erfc_parsers
>>
> All I see in this repo is a CSV parser?

You are absolutely right. I am not sure where my head was. I have an
smtp parser to publish there as well. I guess in my mind I had already
published it. Sorry for the confusion.

Richard Carlsson

unread,
Oct 10, 2011, 8:01:32 PM10/10/11
to erlang-q...@erlang.org
On 10/10/2011 11:30 PM, David Mercer wrote:
> On Monday, October 10, 2011, Andrew Thompson wrote:
>
>> I'm the author and maintainer of (in my biased view) the most complete
>> SMTP library for erlang, gen_smtp:
>>
>> https://github.com/Vagabond/gen_smtp
>>
>> gen_smtp includes both a SMTP client, and a callback framework for
>> writing SMTP servers. It's part of several other erlang projects now,
>> including Zotonic and Chicago Boss.
>
> Thanks. That worked fine out of the box. I must admit, I am surprised
> there is no SMTP client in the standard distribution. You would think that
> would be a fairly common communication protocol...

Often, what you want is more than just SMTP. If there are some network
issues (or your mail server is simply down) at the time your program
tries to send the mail, you usually want your program to still be able
to regard the mail as sent and carry on. This means that the mail needs
to be persistently stored on disk in a spool area and that the MTA
regularly tries to send any outgoing mail that's been spooled, so it
will eventually be on its way once the problem is resolved. That's why
we like to rely on sendmail instead. But it all depends on the needs of
your application.

/Richard

Ahmed Al-Saadi

unread,
Oct 11, 2011, 1:43:37 AM10/11/11
to erlang-q...@erlang.org
On 10/10/11 5:30 PM, David Mercer wrote:
> On Monday, October 10, 2011, Andrew Thompson wrote:
> ...
> ... I must admit, I am surprised

> there is no SMTP client in the standard distribution. You would think that
> would be a fairly common communication protocol...
> ...
You will be more surprised to find (almost) no Unicode support in the
standard distribution!

-signed(ahmed).

Robert Raschke

unread,
Oct 11, 2011, 5:31:29 AM10/11/11
to erlang-q...@erlang.org
On Tue, Oct 11, 2011 at 6:43 AM, Ahmed Al-Saadi <thater...@gmail.com> wrote:
On 10/10/11 5:30 PM, David Mercer wrote:
On Monday, October 10, 2011, Andrew Thompson wrote:
...
...  I must admit, I am surprised

there is no SMTP client in the standard distribution.  You would think that
would be a fairly common communication protocol...
...
You will be more surprised to find (almost) no Unicode support in the standard distribution!

-signed(ahmed).


???

Dealing with Unicode is highly application dependent.

I would say that the majority of code dealing with strings transports them from one place to another, and then binaries and the unicode module are excellent! And for reasonable string manipulation a list of code points (or UTF-8 binaries) are all you will need for a long time.

If you require a deeper understanding of Unicode code points, combining forms, and their visual representations (e.g., when implementing an editor), then you've got a ton more problems. And those are hard problems with more corner cases that you would ever wish for.

Apologies for veering off topic, and probably coming across a wee bit too harsh,
Robby

Ahmed Al-Saadi

unread,
Oct 11, 2011, 9:52:20 AM10/11/11
to Robert Raschke, erlang-q...@erlang.org
I meant to point out that Erlang does not have a Unicode string as a first-class citizen that the standard library generally uses as the standard input/output. However, I should mention that I find treating strings as a list of codepoints (or encoding bytes) to be elegant (read: more general, less magical). Coming from a Python background, I was surprised (read: confused) by how Erlang dealt with strings. On the plus side, I prefer its "closer-to-the-metal" approach to dealing with text and encoding, especially when I have extra brain-power to spend on understanding how things work ;)

Cheers!
Ahmed

David Mercer

unread,
Oct 11, 2011, 1:21:03 PM10/11/11
to Richard Carlsson, erlang-q...@erlang.org
On Monday, October 10, 2011, Richard Carlsson wrote:

> On 10/10/2011 11:30 PM, David Mercer wrote:
> > I must admit, I am
> surprised
> > there is no SMTP client in the standard distribution. You would
> think that
> > would be a fairly common communication protocol...
>
> Often, what you want is more than just SMTP. If there are some network
> issues (or your mail server is simply down) at the time your program
> tries to send the mail, you usually want your program to still be able
> to regard the mail as sent and carry on. This means that the mail needs
> to be persistently stored on disk in a spool area and that the MTA
> regularly tries to send any outgoing mail that's been spooled, so it
> will eventually be on its way once the problem is resolved. That's why
> we like to rely on sendmail instead. But it all depends on the needs of
> your application.

Having an SMTP module would enable you to write in Erlang what you need for
storing messages for later delivery, if that happened to be your
requirement.

What do people think of an EEP to add SMTP support? I'm thinking I might be
the only person who needs it, since Erlang is, like, 100 years old and it's
not in there yet. Is there a silent majority secretly hoping for SMTP in
the next release of Erlang, or am I standing alone on this hill?

Cheers,

DBM

Loïc Hoguin

unread,
Oct 11, 2011, 1:38:55 PM10/11/11
to David Mercer, erlang-q...@erlang.org
On 10/11/2011 07:21 PM, David Mercer wrote:
> On Monday, October 10, 2011, Richard Carlsson wrote:
>
>> On 10/10/2011 11:30 PM, David Mercer wrote:
>>> I must admit, I am
>> surprised
>>> there is no SMTP client in the standard distribution. You would
>> think that
>>> would be a fairly common communication protocol...
>>
>> Often, what you want is more than just SMTP. If there are some network
>> issues (or your mail server is simply down) at the time your program
>> tries to send the mail, you usually want your program to still be able
>> to regard the mail as sent and carry on. This means that the mail needs
>> to be persistently stored on disk in a spool area and that the MTA
>> regularly tries to send any outgoing mail that's been spooled, so it
>> will eventually be on its way once the problem is resolved. That's why
>> we like to rely on sendmail instead. But it all depends on the needs of
>> your application.
>
> Having an SMTP module would enable you to write in Erlang what you need for
> storing messages for later delivery, if that happened to be your
> requirement.
>
> What do people think of an EEP to add SMTP support? I'm thinking I might be
> the only person who needs it, since Erlang is, like, 100 years old and it's
> not in there yet. Is there a silent majority secretly hoping for SMTP in
> the next release of Erlang, or am I standing alone on this hill?

There are SMTP modules. Why do you need them to be in the standard
distribution? You can just use them as a dependency.

--
Loïc Hoguin
Dev:Extend

David Mercer

unread,
Oct 11, 2011, 2:13:51 PM10/11/11
to Loïc Hoguin, erlang-q...@erlang.org
On Tuesday, October 11, 2011, Loïc Hoguin wrote:

> There are SMTP modules. Why do you need them to be in the standard
> distribution? You can just use them as a dependency.

Good question. I guess just to avoid having to ask this list which is the
state of the art, but that's very unsocial of me...

I'm not pushing for it. I've got a solution to my immediate needs (by
asking this list), I just thought it might help those who come after me.
Ah, how very altruistic of me, eh?

Cheers,

DBM

Loïc Hoguin

unread,
Oct 11, 2011, 2:30:06 PM10/11/11
to David Mercer, erlang-q...@erlang.org
On 10/11/2011 08:13 PM, David Mercer wrote:
> On Tuesday, October 11, 2011, Loïc Hoguin wrote:
>
>> There are SMTP modules. Why do you need them to be in the standard
>> distribution? You can just use them as a dependency.
>
> Good question. I guess just to avoid having to ask this list which is the
> state of the art, but that's very unsocial of me...
>
> I'm not pushing for it. I've got a solution to my immediate needs (by
> asking this list), I just thought it might help those who come after me.
> Ah, how very altruistic of me, eh?

What we need, in my opinion, is not a big standard distribution that can
do everything including distributed coffee, but a big package repository
that would be well integrated into Erlang's tools so we could just have
Erlang pull them when needed. Rebar dependencies are doing half the work
there, all that's missing is a community maintained repository that's
supported officially by a big player (either Erlang/OTP or rebar).

--
Loïc Hoguin
Dev:Extend

David Mercer

unread,
Oct 11, 2011, 5:26:02 PM10/11/11
to Loïc Hoguin, erlang-q...@erlang.org
On Tuesday, October 11, 2011, Loïc Hoguin (which is a really cool name, by
the way) wrote:

> What we need, in my opinion, is not a big standard distribution that
> can
> do everything including distributed coffee, but a big package
> repository
> that would be well integrated into Erlang's tools so we could just have
> Erlang pull them when needed. Rebar dependencies are doing half the
> work
> there, all that's missing is a community maintained repository that's
> supported officially by a big player (either Erlang/OTP or rebar).

Rebar, I don't think, is in Erlang, and it doesn't work on all Erlang
platforms. If it can be rewritten in Erlang, it might work for this
purpose...

I don't disagree with you otherwise.

Cheers,

DBM

Jack Moffitt

unread,
Oct 11, 2011, 5:32:16 PM10/11/11
to David Mercer, erlang-q...@erlang.org
> Rebar, I don't think, is in Erlang, and it doesn't work on all Erlang
> platforms.  If it can be rewritten in Erlang, it might work for this
> purpose...

Um, rebar is most definitely in Erlang. However, you are correct that
it's windows support is a little weaker than the other systems.

Code can be browsed here:
http://github.com/basho/rebar

jack.

Michael Schreckenbauer

unread,
Oct 11, 2011, 5:35:44 PM10/11/11
to erlang-q...@erlang.org
On Tuesday, 11. October 2011 16:26:02 David Mercer wrote:
> On Tuesday, October 11, 2011, Loïc Hoguin (which is a really cool name, by
>
> the way) wrote:
> > What we need, in my opinion, is not a big standard distribution that
> > can
> > do everything including distributed coffee, but a big package
> > repository
> > that would be well integrated into Erlang's tools so we could just have
> > Erlang pull them when needed. Rebar dependencies are doing half the
> > work
> > there, all that's missing is a community maintained repository that's
> > supported officially by a big player (either Erlang/OTP or rebar).
>
> Rebar, I don't think, is in Erlang, and it doesn't work on all Erlang
> platforms. If it can be rewritten in Erlang, it might work for this
> purpose...

https://github.com/basho/rebar
looks rather erlang-ish to me :)

> I don't disagree with you otherwise.
>
> Cheers,
> DBM

Best,
Michael

David Mercer

unread,
Oct 11, 2011, 5:43:48 PM10/11/11
to Jack Moffitt, erlang-q...@erlang.org
On Tuesday, October 11, 2011, Jack Moffitt wrote:

> > Rebar, I don't think, is in Erlang, and it doesn't work on all Erlang
> > platforms.  If it can be rewritten in Erlang, it might work for this
> > purpose...
>
> Um, rebar is most definitely in Erlang. However, you are correct that
> it's windows support is a little weaker than the other systems.

Mea culpa. I was just guessing, given its lack of Windows support. Why
wouldn't it work on Windows, then, if it's in Erlang. Erlang runs on
Windows...

DBM

Jack Moffitt

unread,
Oct 11, 2011, 5:54:59 PM10/11/11
to David Mercer, erlang-q...@erlang.org
> Mea culpa.  I was just guessing, given its lack of Windows support.  Why
> wouldn't it work on Windows, then, if it's in Erlang.  Erlang runs on
> Windows...

I believe it makes a few assumptions about the shell environment. I
believe there are people working to address this if list traffic on
the rebar list is any indication. I imagine some parts of it work just
fine, and I'm sure feedback would be appreciated to find the remaining
rough edges.

jack.

Tony Rogvall

unread,
Oct 12, 2011, 3:28:58 AM10/12/11
to Loïc Hoguin, erlang-q...@erlang.org
On 11 okt 2011, at 20:30, Loïc Hoguin wrote:


What we need, in my opinion, is not a big standard distribution that can
do everything including distributed coffee, but a big package repository
that would be well integrated into Erlang's tools so we could just have
Erlang pull them when needed. Rebar dependencies are doing half the work
there, all that's missing is a community maintained repository that's
supported officially by a big player (either Erlang/OTP or rebar).


+1

/Tony


--
Loïc Hoguin
Dev:Extend
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



Robert Raschke

unread,
Oct 12, 2011, 3:59:51 AM10/12/11
to erlang-q...@erlang.org
On Tue, Oct 11, 2011 at 10:43 PM, David Mercer <dme...@gmail.com> wrote:
On Tuesday, October 11, 2011, Jack Moffitt wrote:

> > Rebar, I don't think, is in Erlang, and it doesn't work on all Erlang
> > platforms.  If it can be rewritten in Erlang, it might work for this
> > purpose...
>
> Um, rebar is most definitely in Erlang. However, you are correct that
> it's windows support is a little weaker than the other systems.

Mea culpa.  I was just guessing, given its lack of Windows support.  Why
wouldn't it work on Windows, then, if it's in Erlang.  Erlang runs on
Windows...

DBM


I've never experienced any issues with running rebar under Windows. The only hurdle is that it is usually invoked from a Makefile. And that's not really a hurdle, more like a bit of uneven ground. ;-)

Robby
 

David Mercer

unread,
Oct 12, 2011, 11:19:24 AM10/12/11
to Robert Raschke, erlang-q...@erlang.org

Aw, y’all are making me work for my opinion.  I’m going to have to pull out rebar again and see what my problems with it were.  Make shouldn’t have been an issue, since I use make all the time.  I’ll let you know what I find out…

Tim Watson

unread,
Oct 12, 2011, 12:29:15 PM10/12/11
to Jack Moffitt, erlang-q...@erlang.org
On 11 October 2011 22:54, Jack Moffitt <ja...@metajack.im> wrote:
> Mea culpa.  I was just guessing, given its lack of Windows support.  Why
> wouldn't it work on Windows, then, if it's in Erlang.  Erlang runs on
> Windows...

I believe it makes a few assumptions about the shell environment. I
believe there are people working to address this if list traffic on
the rebar list is any indication. I imagine some parts of it work just
fine, and I'm sure feedback would be appreciated to find the remaining
rough edges.


There are indeed a number of people working towards better windows support and it's getting better all the time! 

Tim Watson

unread,
Oct 12, 2011, 12:31:46 PM10/12/11
to Tony Rogvall, erlang-q...@erlang.org
On 12 October 2011 08:28, Tony Rogvall <to...@rogvall.se> wrote:

On 11 okt 2011, at 20:30, Loïc Hoguin wrote:
What we need, in my opinion, is not a big standard distribution that can
do everything including distributed coffee, but a big package repository
that would be well integrated into Erlang's tools so we could just have
Erlang pull them when needed. Rebar dependencies are doing half the work
there, all that's missing is a community maintained repository that's
supported officially by a big player (either Erlang/OTP or rebar).
+1

/Tony

I thoroughly agree that this is a great idea!

Björn-Egil Dahlberg

unread,
Oct 12, 2011, 4:48:00 PM10/12/11
to Tim Watson, erlang-q...@erlang.org
2011/10/12 Tim Watson <watson....@gmail.com>
+ 1

agner?   
Reply all
Reply to author
Forward
0 new messages