What is the correct method to include the referrer address in the email sent from a PHP page?
When sending an email from a PHP page, you can include the referrer address by accessing the HTTP referer header. This can be done by using the $_SERVER['HTTP_REFERER'] variable to capture the referrer address and then include it in the email content or headers.
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Unknown';
$email_content = "Referrer Address: " . $referrer;
// Include the referrer address in the email headers or content
$headers = "From: sender@example.com \r\n";
$headers .= "Reply-To: sender@example.com \r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
// Send the email
mail('recipient@example.com', 'Subject', $email_content, $headers);