Node.js as SMTP server emulator

191 views
Skip to first unread message

Dave Westerman

unread,
May 1, 2015, 8:01:45 AM5/1/15
to nod...@googlegroups.com
In testing a module that sends emails, I was wondering if there was some way that I could create a dummy SMTP server with Node.js. I would want it to receive the email requests, and then instead of actually sending emails, it would just write some info from the emails to a file, which I could then read to make sure the emails were created correctly.

Can node.js handle smtp? Or can it only process http traffic?

Aria Stewart

unread,
May 1, 2015, 4:57:28 PM5/1/15
to nod...@googlegroups.com

> On Apr 30, 2015, at 10:41 AM, Dave Westerman <david.l....@gmail.com> wrote:
>
> In testing a module that sends emails, I was wondering if there was some way that I could create a dummy SMTP server with Node.js. I would want it to receive the email requests, and then instead of actually sending emails, it would just write some info from the emails to a file, which I could then read to make sure the emails were created correctly.
>
> Can node.js handle smtp? Or can it only process http traffic?

Absolutely. The registry has several modules for that exactly, plus haraka which is a whole SMTP server you can use in production.

Aria

Adrian Lynch

unread,
May 1, 2015, 4:59:30 PM5/1/15
to nod...@googlegroups.com
This looks like the ticket: https://github.com/andris9/smtp-server

On 30 April 2015 at 15:41, Dave Westerman <david.l....@gmail.com> wrote:
In testing a module that sends emails, I was wondering if there was some way that I could create a dummy SMTP server with Node.js. I would want it to receive the email requests, and then instead of actually sending emails, it would just write some info from the emails to a file, which I could then read to make sure the emails were created correctly.

Can node.js handle smtp? Or can it only process http traffic?

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/32129931-05a5-4ed2-b83a-88e51391dcdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt

unread,
May 3, 2015, 9:53:56 PM5/3/15
to nod...@googlegroups.com
Andris' smtp-server is great though requires a little coding.

With Haraka running the test_queue plugin, it just writes every mail to /tmp/mail.eml which might be exactly all you need.

Reply all
Reply to author
Forward
0 new messages