I am sending a mail(Gmail) to a group of people in cc and one user is in to using PHP which contains a button to acknowledge, I am sending a token with it(I can also use JWT token). How to know that the acknowledge button is clicked by to emailId user, as the token or other things will be same for everyone.
Here is the sample code I am using:-
For sending mail I am using SendGrid API service in PHP
$tokenValue = 'AnyRandomValueorJWTTokenGoesHere';
$mailContent = '<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<a href="localhost:3000/mailVerify.php?myToken='.$tokenValue.'"
class="button" > Verify </a>
<script src="script.js"></script>
</body>
</html>';
$email = new \SendGrid\Mail\Mail();
$email->setFrom("test@example.com", "Example User");
$email->setSubject("Sending with Twilio SendGrid is Fun");
$email->addTo("test@example.com", "Example User");
foreach ($cc as $email) {
$email->addCc($email, explode("@",$email)[0]);
}
$email->addContent("text/html", $mailContent);
$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY'));
try {
$response = $sendgrid->send($email);
print $response->statusCode() . "\n";
print_r($response->headers());
print $response->body() . "\n";
} catch (Exception $e) {
echo 'Caught exception: '. $e->getMessage() ."\n";
}
Any help in this regards would be appreciated. Thanks.