1

I'm integration EmailJs with my mern stack application. Can I pass/change my To email address through code? Currently, it's sending an email to address on which I have made account of EmailJs. I want to send an email to address which I write on runtime.

const variables = {
    message_html: 'message',
    from_name:'name',
    reply_to: "email@gmail.com"
}

window.emailjs.send(
    'gmail',
    templateId,
    variables
).then(res => {
    console.log('Email successfully sent!')
})
// Handle errors here however you like, or use a React error boundary
.catch(err => console.error('Oh well, you failed. Here some thoughts on the error that occured:', err)) 
mgarcia
  • 5,669
  • 3
  • 16
  • 35
Johnn
  • 11
  • 3
  • Welcome on StackOverflow, Could you develop a little bit what you are trying to achieve. What problem are you facing ? – A. Ecrubit May 01 '20 at 19:23
  • I want to send email to user through my aplication , the problem is how can i set the receiver email adress? i am using reactJs – Johnn May 01 '20 at 19:28
  • 1
    You need to show more code or to explain how you want to achieve this. Are you getting the user email from an input, from an API call ? – A. Ecrubit May 01 '20 at 19:43
  • i am getting user email as input, i just need to what is the variable name of receiver adress, like i write "reply_to". how can i pass receiver email to emailjs.send () function – Johnn May 02 '20 at 08:03

1 Answers1

0

No, EmailJS does not seem to support spamming arbitrary email addresses, you have to Connect your own email service to receive the emails.

Aprillion
  • 21,510
  • 5
  • 55
  • 89
  • there is no other way i can send email to my website users? – Johnn May 02 '20 at 09:51
  • sure, from the backend - e.g. https://stackoverflow.com/questions/4113701/sending-emails-in-node-js or https://stackoverflow.com/questions/882712/sending-html-email-using-python – Aprillion May 02 '20 at 11:29