mikelons
New Member
- Messages
- 16
- Reaction score
- 0
- Points
- 1
Hello, I am still having issues with emails not arriving in my account due to the PHP email header in my code that allow me to format the emails users send me. The header are simple and should allow emails to arrive in my inbox without issue. I am on server named "absolut" and my email address is mike@mikelonsdale.co.uk
Here is the PHP code
Here is the PHP code
PHP:
<?php
$to = "mike@mikelonsdale.co.uk";
$subject = "Feedback from Your Website.";
$email = ($_POST['email']);
$name = ($_POST['name']);
$reason = ($_POST['Subject']);
$message = ($_POST['feedback']);
$ip = $_SERVER['REMOTE_ADDR'];
$headers = "From: " . strip_tags($_POST['email']) . "\r\n"; //Header causing the problem - Places users email in From field
$headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n"; //Header causing the problem - Add users email in the reply to field
$headers .= "MIME-Version: 1.0\r\n"; //Header causing the problem - set MIME version.
$text = "Ip Address: " . $ip . "\r\n";
$text .= "Name: " . $name . "\r\n";
$text .= "Email: " . $email . "\r\n";
$text .= "Reason for feedback: " . $reason . "\r\n";
$text .= "Message: " . $message . "\r\n";
//check to see the required fields have been filled in.
if (empty($_POST["name"]) || empty($_POST["email"]) || empty($_POST["feedback"]))
{
include ("contact_error.html");
}
elseif (!filter_var($email, FILTER_VALIDATE_EMAIL))
{
include ("contact_email.html");
}
else
{
//send email
mail($to, $subject, $text, $headers);
include ("contact_sent.html");
}
?>
Last edited: