Search code examples
phpemailsmtpverification

URL in email body is being checked before email is sent


I am having an issue trying to create an email verification link. I add the lin k in the body of the email, and when that url is visited, it verifies the emial using the parameters in the url. However, when the email is sent, it visits that link automatically, and verifies it. Does anyone know why it does this, or what I am doing wrong?

Here's my code

$to = $_POST['email'];
$subject = "";
$headers = "From: [email protected]" . "\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "<html><body><p>Here's a message</p>";
$message .= '<a href="http://www.example.com/verification.php?mv6e='.$encode.'&cv6v='.$verification.'">Click here to verify your application</a></body></html>';
mail($to, $subject, $message, $headers);

This should set a field in a database to "Verified". However, when the email is sent, the field is set to "Verified" before the user can even click on the link. Which gives me the impression that something is visiting the link beforehand. Any insight would be greatly appreciated.


Solution

  • Might be a spam filter that checks the links in all emails. For example, gmail scans all emails for links to malicious websites.

    You can add a recaptcha to the verification page to make sure it is visited by a human, not some spam filtering bot.