Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to send an email using my server's domain in nodejs

Tags:

So I have a server with ip, domain(www.example-sato.com), and have a nodejs/express.js app running on it.

When user registers I would like to send an email to the user with an sender like [email protected].

What generally should I do?

  1. should I install postfix in my server?
  2. or should I install some npm package, then set in express.js?
like image 282
Sato Avatar asked Apr 07 '16 11:04

Sato


1 Answers

What I've used and find extremely easy to setup is nodemailer npm package. It has built-in SMTP transport, as well as the ability to use external ones. And it works pretty well on Windows, if that's a concern to you.

Installing postfix is an option, but you will still need npm package in order to use it. With nodemailer you can even use external STMP (or other) servers, like Gmail for example, which is very handy while in development. I mean you can use it with whatever mail server you want, if you don't like the built-in one :)

like image 109
Andrey Popov Avatar answered Sep 28 '22 02:09

Andrey Popov