0

I am working on an email verification functionality. The problem is that I want if someone clicks on the Confirm email address button then an alert should be shown up or a user should be notified the button is clicked but it does not perform any actions on my Gmail account.

What are the ways to make it work?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <center><h1>We're glad you're here</h1></center>
    <center>We just want to confirm it's you.<br><br></center>
    <center>
        <button onclick="myFunction()">
            Click to confirm your email address
        </button>
    <center>
    <center><br>If you didn't create a proctl account, just delete this email.</center>

    <script>
        function myFunction() {
          alert("I am an alert box!");
        }
    </script>
</body>
</html>
  • Most of email providers such as Gmail did not allow you to run JS. Even the CSS have limitations. – vee Jan 13 '23 at 05:53
  • @vee Is there any other alternative to it? What should I choose? – Kaifah Habibi Jan 13 '23 at 05:56
  • I've [answered and tested this](https://stackoverflow.com/questions/70236290/receive-email-read-receipt-in-mail/70249578#70249578) before but currently I can't make sure that is it still working. – vee Jan 13 '23 at 06:02
  • Or just use normal link `...`. – vee Jan 13 '23 at 06:17

1 Answers1

0

Due to security concerns, Javascript is not supported in email messages. So instead of verifying it by js onclick event, you can insert an HTML link to it.

Ref: Is JavaScript supported in an email message?