Home > Blockchain >  Registration notification over email in Node.js
Registration notification over email in Node.js

Time:05-09

I made an app (nextJS) that requires the user to register. The user opens the registration page and then enters username(email address) and password. When they click on the submit button this data is stored in a database and they are registered. However, I would also like my code to automatically send the user an email that thanks them for registering and some extra information. But I have no idea how to do this. I searched a lot online but I don't really find anything. I mostly only find information about sending emails to my own email address or info about mailing lists. I am a bit surprised I don't find the info I am looking for easily because this is something that is used all of the time. Anyway, can anyone point me in the right direction ?

CodePudding user response:

You can use Nodemailer for this functionality. For detail information please search on google "How To Create a Signup Confirmation Email With Node.js". Thank you

CodePudding user response:

If you don't mind paying a little check out Postmark:
https://postmarkapp.com/

Node.js implementation:
https://postmarkapp.com/developer/integration/official-libraries#node-js

Very painless setup and great deliverability, especially for small businesses.

CodePudding user response:

Thanks to everyone for their replies. In the end I used emailJS. It is possible in an emailjs template to parametrize the address to which you sent the email. Knowing this it is extremely simple to achieve what I wanted. This simple documentation explains how to use emailjs.

https://www.emailjs.com/docs/sdk/send/

Basically if in the emailjs template you specify that you want the mail to be sent to {{to_address}}, then you can use the following line of code to automatically send an email to <to_address>.

emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', {to_address: '[email protected]'}, 'PUBLIC_KEY')

The package I installed:

npm install @emailjs/browser --save
  • Related