May you are trying to spoof email, so it’s getting failed.
It would be great practise to keep using Reply-To with From while using mail()
$headers .= "From: f[email protected]";
$headers .= "Reply-To: [email protected]";
But, personally suggest you to use SMTP instead of mail() or PHPMailer.
I’m sending email using php header.
$to = '[email protected]';
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$message = '<h1>Test</h1>';
mail($to, $subject, $message, $headers);
This function is working properly.
But after I added “From” mail() function is not working.
$headers .= "From: [email protected]";
Any idea?