35

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?

alienhard
  • 14,376
  • 9
  • 37
  • 28
AppleGrew
  • 9,302
  • 24
  • 80
  • 124

4 Answers4

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).

BMiner
  • 16,669
  • 12
  • 53
  • 53
  • 5
    Also, I don't like Haraka. :) – BMiner May 21 '12 at 18:38
  • 1
    interesting. Any specific reasons you don't like Haraka? Too complex, or something like that? – JasonSmith Jul 31 '12 at 08:32
  • 4
    @JasonSmith Yes, pretty much. Haraka is way too heavy for me, and there seems to be a much larger learning curve. The simplicity of [simplesmtp](https://github.com/andris9/simplesmtp) in conjunction with [mailparser](https://github.com/andris9/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. – BMiner Jul 31 '12 at 14:44
  • 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. – bennidi Oct 29 '12 at 12:11
  • 2
    @tfmontague [smtp-server](https://github.com/andris9/smtp-server) is written by the same author and is the successor to Simple SMTP. –  Mar 26 '15 at 19:55
  • MailIn server use for receiving mail, parses them. – Chirag Jun 13 '17 at 08:55
25

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

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

Matt Sergeant
  • 476
  • 4
  • 4
10

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.

Jonathan Julian
  • 12,163
  • 2
  • 42
  • 48
  • 10
    By the way, this answer is meant to sound like "give it a try, you can do it" not like "whatever, that's easy." :) – Jonathan Julian Apr 14 '11 at 02:20
  • 1
    Well I found [Haraka](https://github.com/baudehlo/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. – AppleGrew Apr 14 '11 at 04:58
  • 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. –  Mar 26 '15 at 19:33
  • 4
    300 lines of code is not a measure. One can write those 300 lines for several days or even weeks. – Green Jul 24 '16 at 09:58
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.

  • Is Haraka for sending or receiving emails? – Green Jul 24 '16 at 09:59
  • 1
    @Green 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)](https://en.wikipedia.org/wiki/Email_agent_(infrastructure)) to get an idea of where an MTA fits in. –  Jul 24 '16 at 10:15