My mail script is only sending mail when the headers aren't set. I'm using the same code on two different servers, it works on one but not the other. The one it doesn't work on is a WordPress site hosted on Siteground if that makes any difference. Even when it doesn't send, it always comes up as a 'success'. Does anyone know what I can do? I was hoping to find some kind of mail error logs, but I can't seem to locate them. I've tried it with just the email as the header but still doesn't work.
$headers = array("From: " . $name . '<' . $email . '>',
"Reply-To: " . $name . '<' . $email . '>',
"X-Mailer: PHP/" . PHP_VERSION,
"MIME-Version: 1.0",
"Content-type: text/html; charset=iso-8859-1"
);
$headers_buyer = implode("\r\n", $headers);
if(mail($admin_email, $subject, $message, $headers_buyer))
{
echo "Success";
}
else
{
echo "Failure";
}