So, I have this PHP script on my website that sends a mail:
<?php
$name= $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$city = $_REQUEST['city'];
$message = $_REQUEST['message'];
$destination = "my@mail.com";
$subject = "Contact Message";
$header = "From: $email\r\n";
$header .= "Return-Path: $email\r\n";
$message2 = "Name: $name\r\n";
$message2 .="Phone: $phone\r\n";
$message2 .= "Email: $email\r\n";
$message2 .= "City: $city\r\n";
$message2 .= "Message: $message";
mail($destination, $subject, $message2, $header);
header('Location: thanks.php');
?>
and the HTML is:
<form method="post" action="mail.php">
<p>Name</p>
<input type="text" name="name" required>
<p>Phone</p>
<input type="tel" name="phone" required>
<p>Email</p>
<input type="email" name="email" required>
<p>City</p>
<input type="text" name="city" required>
<p>Message</p>
<textarea name="message" required></textarea>
<button type="submit">SEND</button>
<div class="clear"></div>
</form>
However the mail won't be sent if the mail is not my@mail.com (the same as my fixed destination). I don't why it happens, I have no clue at all. I've double checked every word to see if there's something wrong, but nothing. I've been using this script in multiple pages and it worked everytime.