0

So i try to use javascript in html when i send email with nodemailer.But when i alert, JS does not working at all.Do i need to create another page in order to do that?

Thanks.

    let testAccount = await nodemailer.createTestAccount();

    let transporter = nodemailer.createTransport({
      host: "smtp.ethereal.email",
      port: 587,
      secure: false, 
      auth: {
        user:"**********", // generated ethereal user
        pass:"**********", // generated ethereal password
      },
    });

    // send mail with defined transport object
    let info = await transporter.sendMail({
      from: '"***************', // sender address
      to: "***************", // list of receivers
      subject: "Email Verification ✔", // Subject line
      text: "Email Verification", // plain text body
      html:" <h1>Verrification email</h1> <h2>Click the button so you can verify your account!</h2> <button id = 'button' type='button'>Verify!</button>  <script> document.getElementById('button').onclick = function(){alert('Verified')} </script>"
    });
Thanos Rom
  • 123
  • 1
  • 1
  • 8
  • It doesn't seem that you can use javascript in a email : https://stackoverflow.com/questions/3054315/is-javascript-supported-in-an-email-message – Emilien Dec 12 '22 at 08:57
  • Thanks for saving my time ,yeah my bad..im was trying to verify mobile app with webiste url...i've done it with some digit codes via email . – Thanos Rom Dec 13 '22 at 17:17

0 Answers0