How to add text to email sent from a php contact form

Posted by JustStatic on Stack Overflow See other posts from Stack Overflow or by JustStatic
Published on 2012-11-14T16:55:53Z Indexed on 2012/11/14 17:00 UTC
Read the original article Hit count: 316

Filed under:
|
|

Hi all this is the PHP im using:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Message: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-decoration:none;
color:#ff0099;'> Return Home</a>";
?>

Its working perfectly fine but i would like there to be some text sent with this email that says "This is from your website" or something similar to tell the recipient that it isnt spam (my client isn't tech friendly and sees everything plain text as spam). I'm very new to PHP with nearly 0 knowledge and have no idea how to add something like that. I did have a go at making a new variable with the string inside and then include that in the:

mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

line but with no success. Thanks for taking the time any help would be welcome.

© Stack Overflow or respective owner

Related posts about php

Related posts about email