Implement mail confirmation without using external mail server?

813 views Asked by At

I'm building a Hapi app and I want to implement basic user email confirmation feature. I'm a bit lost as I don't have prior experience on mail servers nor have I implemented mailing feature to any apps. I do NOT want to use external mail service such as Google for sending the emails. There is also no need to be able to receive email nor store the sent messages. I want the emails be sent from address '[email protected]', where I already have a running web app in mydomain.com. The server is a Centos 7 running in EC2.

Do I have to setup own mail server (Haraka, Postfix, etc.) or can I send email directly to the users from my Node.js app (Nodemailer, Hapi Mailer, etc.), without using neither local nor remote mail server? I looked at some examples, but they usually use Google or such for sending the mail, so I'm not sure how to achieve exactly what I want, i.e. simple mail confirmation messages sent from Node.js app.

2

There are 2 answers

0
mikefrey On

Node.js does not have a built-in SMTP server, and you must have an SMTP server of some kind to send email.

It is possible to run your own SMTP server with Node.js (https://github.com/andris9/smtp-server) and then use Nodemailer or Hapi Mailer with it.

0
Lironess On

Try using this : https://github.com/paullang/hapi-mail

This is a plugin built especially for hapi.