Sending emails with âpure Reactâ
Can you send even the simplest emails from a React-powered website without any 3rd-party plugins? Unfortunately not. React JS apps are run on the client-side (in a browser) and the SMTP server needs to be set up on the server-side. In theory, you could provide your SMTP credentials on the client-side, directly in the code. But since leaving such sensitive data for everyone to see and use is a rather poor idea, weâre not going to elaborate on it any further.
Weâre going to talk later on about how to set up an express backend and add a 3rd party mailing capability. Letâs start with an easier method first, though!
Sending emails with EmailJS
Now, letâs look at the approach that wonât require setting up a backend at all.
Weâll set up an external tool to handle email sending for us and weâll only make sure to trigger this tool when a mailing is due. Weâre going to use a very popular service called EmailJS. It lets you connect your email client in the browser, build a template and send it with EmailJS API. The tool is not meant strictly for ReactJS and will also work perfectly with other frameworks such as Vue.js or Angular. There are lots of email services you can use it with, ranging from typical personal-email services such as Gmail and Outlook to more mass-email-bound tools like Mandrill or Mailgun. Pricings for each differ and most come with a free, limited tier.














