33

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
  • 13,966
  • 9
  • 35
  • 28
AppleGrew
  • 8,959
  • 23
  • 77
  • 118

5 Answers5

42

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
  • 15,730
  • 11
  • 50
  • 53
  • 4
    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
  • 446
  • 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
  • 11,973
  • 2
  • 40
  • 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
-2

Personally, I use node_mailer :

send emails from node.js to your smtp server, simple as cake.

From https://github.com/marak/node_mailer :

Features :

  • super simple api
  • emails are blasted out asynchronously
  • uses connection pooling per SMTP server
  • super simple built in templates using Mustache.js
  • SSL supported (NodeJS v0.3.x or later)
Sandro Munda
  • 38,310
  • 24
  • 95
  • 118
  • 3
    Well but I need a smtp server. Reason: I need to filter and process the messages received by the server from outside world. – AppleGrew Mar 29 '11 at 17:32
  • 1
    Hmmm, I see. I have no idea where you can find a implementation stable/release. A lot of alpha/beta available on google, I agree with you. – Sandro Munda Mar 29 '11 at 20:43
  • 9
    OP is looking for a server, not a mailer. – eighteyes Jun 12 '13 at 20:06
  • Project deprecated in favor of nodemailer – OhadR Mar 26 '21 at 14:56
  • nodemailer is a very simple module that sends emails on already existing smtp servers with existing email addresses somewhere. one can't make their own server and email addresses etc with just nodemailer. this is like suggesting localstorage instead of a database. – Raphael Morgan Apr 27 '22 at 22:54