0

I have an application, built using React. If I want to send an email to a user after another user successfully completes an action, what are some technologies I need to or can use? To clarify, I have no backend server set up yet.

  • React is frontend, emails are sent from a backend server. So React has nothing to do with this. It will greatly depend on the technology stack of your backend server. – Alex Wayne Feb 08 '20 at 06:35
  • 1
    see https://stackoverflow.com/questions/55795125/how-to-send-email-from-my-react-web-application – Hamid Shoja Feb 08 '20 at 06:43
  • @AlexWayne I was hoping for answers containing technologies to use, not technologies I don't need to use. – Josh Kardos Feb 08 '20 at 17:19

3 Answers3

1

Check sendgrid! You can do in your backend(nodejs in this case):

const SGmail = require ('@sendgrid/mail')
SGmail.setApiKey(process.env.REACT_APP_SG_API)

app.post('/your/endpoint', (req,res) => {
const data = req.body
const mailOptions = {
    from: data.email,
    to:'email@example.com',
    subject:'Subject',
    html:`<p>${data.name}</p>
        <p>${data.email}</p>
        <p>${data.message}</p>`
}
SGmail.send(mailOptions).then((err,res)=>{res.redirect('/')})
})
Misha
  • 109
  • 8
1

Check out SendGrid, they offer a generous free tier.

jdoroy
  • 898
  • 1
  • 7
  • 10
0

If you're not expected to do the actual email sending, you could, in JS, build an .eml file and have the user "download" it. They would then send it in their client of choice.

Otherwise you will need, at the very least, access to a mail server, to send this multipart-mime to, or, a little safer, build the message on the server and send it internally.

Hashbrown
  • 12,091
  • 8
  • 72
  • 95