Any suggestion for smtp mail server in nodejs?
Asked Answered
P

4

36

I googled out quite a few but all are at best alpha versions, so it seems I will have to try an code one. Instead of coding one from scratch I would like to build on existing implementation, but a good one.

Any suggestions?

Pye answered 29/3, 2011 at 17:15 Comment(1)
Were you intending to only receive email, or send as well?Bouchard
E
43

SMTP server - I've used Simple SMTP in conjunction with mailparser. IMHO, these are the best tools on the Internet for building SMTP servers in Node.js.

UPDATE: Simple SMTP has been deprecated. Use SMTP server instead (the successor of the Simple SMTP module).

Epithet answered 21/5, 2012 at 18:37 Comment(6)
Also, I don't like Haraka. :)Epithet
interesting. Any specific reasons you don't like Haraka? Too complex, or something like that?Overrate
@Overrate Yes, pretty much. Haraka is way too heavy for me, and there seems to be a much larger learning curve. The simplicity of simplesmtp in conjunction with mailparser is what sold me on these tools. I built a secure (TLS) mail server that authenticates users from a DB, parses incoming messages, allows users to upload files to the system by simply sending an email to a specific email address, and more - all under 400 lines of code. If you need a feature like SPAM filtering, Haraka might be the way to go.Epithet
Simple smtp looks very promising to me. Just hook into the events generated by the server and handle the incoming mails in the way you need to. I will definitely use it. Thx.Entrant
@tfmontague smtp-server is written by the same author and is the successor to Simple SMTP.Bustup
MailIn server use for receiving mail, parses them.Matriculation
H
25

Haraka: https://github.com/baudehlo/Haraka

Is a full featured mail server in node.js - should do everything that you need.

Hortative answered 30/5, 2011 at 0:24 Comment(0)
A
11

RFC 2821 (http://tools.ietf.org/html/rfc2821) is not too complex, you should be able to flesh out a server in about 300 lines of js.

Ancy answered 14/4, 2011 at 2:19 Comment(4)
By the way, this answer is meant to sound like "give it a try, you can do it" not like "whatever, that's easy." :)Ancy
Well I found Haraka. It seems good but, it needs Mail Delivery Agent to send mails, furthermore my hosting service already provides good anti-spam protection, spf, etc, so I have decided to write a milter for sendmail in Python.Pye
I 100% agree with the sentiment of this answer. Even if you decide to use a library (which is what I do), writing your own will help you to understand what's going on and is a very valuable exercise. It's not that hard.Bustup
300 lines of code is not a measure. One can write those 300 lines for several days or even weeks.Effrontery
B
9

Some answers here are quite outdated, so I'd like to offer the lastest.

There are currently three Node SMTP servers (libraries) I know of:

There's also mailin which is an SMTP server that receives messages and posts them to some URL for you to process. Mailin uses Python for some optional features.

Bustup answered 26/3, 2015 at 19:50 Comment(2)
Is Haraka for sending or receiving emails?Effrontery
@Effrontery Haraka is a mail transfer agent ("MTA"). Whether it's for "sending" or "receiving" really depends on where you are in the transaction. Have a look at Email_agent_(infrastructure) to get an idea of where an MTA fits in.Bustup

© 2022 - 2024 — McMap. All rights reserved.