node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »


Ehlo SMTP Server

NPM version license Downloads

Build Status Coverage Status Codacy Badge Code Climate

Dependencies Status devDependencies Status peerDependencies Status

Ehlo is a SMTP server which send every mails to an api in a nice json format


npm i -g ehlo

Using It

ehlo -p 10025 -a http://localhost/myAwesomApi

Now send a mail with your favorite lib (like nodemailer) with localhost:10025 as SMTP server.

Your mail will be send with a POST request to http://localhost/myAwesomApi. All the json is posted in a mail form-data variable.

Here a tcpdump of a POST request :

13:41:45.987903 IP > Flags [P.], seq 1:274, ack 1, win 12759, options [nop,nop,TS val 756661265 ecr 756661265], length 273
-...-...POST / HTTP/1.1
host: localhost
content-type: multipart/form-data; boundary=--------------------------511395648416127300743092
content-length: 249
Connection: close
Content-Disposition: form-data; name="mail"
13:41:45.987961 IP > Flags [P.], seq 274:422, ack 1, win 12759, options [nop,nop,TS val 756661265 ecr 756661265], length 148
-...-...{"text":"Just an example\n","headers":{"subject":"Try"},"subject":"Try","priority":"normal"}

You can also store emails to disk with the --save [path] or -s [path] option. Demo

For more informations about the json results, look at the mailparser library.

Setting DNS

If you want to receive real emails on your api, you should setup your DNS RECORDS. For example, if you want to receive emails at *

  • An MX Record: MX 10
  • A a record: mx.subdomain A <ip of your ehlo server>


Provide a pull request (with tested code) to include your work in this main project. Issues may be awaiting for help so feel free to give a hand, with code or ideas.


Ehlo is under the MIT license. Please see LICENSE