Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74846

PHP mailer different on multiple pages

$
0
0

So my website has multiple pages where I want people to have an option to send us a message. I already have setup a php mailer but all the mails have the same layout. How can I make to where if the message has been send form a specific page I add specific words to the mail? The mailsender works on both the pages but the layout and everything is the same.

THIS IS THE CODE THAT WORKS FOR ME:

<?php
// Check for empty fields
if(empty($_POST['name'])      ||
   empty($_POST['email'])     ||
   empty($_POST['phone'])     ||
   empty($_POST['message'])   ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
   echo "No arguments Provided!";
   return false;
   }

$name = strip_tags(htmlspecialchars($_POST['name']));
$email_address = strip_tags(htmlspecialchars($_POST['email']));
$phone = strip_tags(htmlspecialchars($_POST['phone']));
$message = strip_tags(htmlspecialchars($_POST['message']));

$URL = $_SERVER['HTTP_REFERER'];




// Create the email and send the message
$to = 'boonwijkkermis@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "Nieuwe mail ontvangen via boonwijkkermis.com.\n\nNaam:\n $name \n\nEmail:\n $email_address \n\nTelefoon nummer:\n $phone \n\nBericht:\n$message \n\nURL:\n $URL";
$headers = "From: no-reply@boonwijkkermis.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";   
mail($to,$email_subject,$email_body,$headers);
return true;
?>

Viewing all articles
Browse latest Browse all 74846

Latest Images

Trending Articles



Latest Images