电子邮件不通过现场服务器,但工作通过本地主机Xampp


Email not going through on live server but works through local host Xampp

嘿,伙计们,我有这个奇怪的问题,从我的联系方式发送信息到我的电子邮件地址。我已经通过Xampp在本地主机上测试了我的代码,我收到了非常好的电子邮件,但是当我将代码上传到服务器并提交时。成功消息显示,但没有收到电子邮件,甚至没有在垃圾文件夹。

<?php
$name = $_POST['name1'];
$email = $_POST['email2'];
$message = $_POST['message3'];
$from = 'From: Testing';
$to = 'testing@hotmail.com';
$subject = 'Contact Form Testing';
$body = "From: $name'n Email: $email'n Message:'n $message";
if ($_POST['submit']){
    /*Do something when the submit has been pressed*/
    if (mail ($to, $subject, $body, $from)){
        $_SESSION['Success'] = '<div class="alert alert-success" role="alert">Your Message Has Been Sent!</div>';
        header('Location: index.php#fifthpage');
    } else{
        $_SESSION['Error'] = '<div class="alert alert-danger" role="alert">Something Went Wrong Please Try Again!</div>';
        header('Location: index.php#fifthpage');
    }
}
?>
    $to = 'testing@hotmail.com';
    $from = $_POST['email2'];
    $subject = 'Contact Form Testing';
    $body = $_POST['message3']."'r'n";
    $headers = "From: $from'r'nReply-to: $from";
    $sent = mail($to, $subject, $body, $headers);
if($sent){
echo "The message was sent";
}
else{
    echo "Sending failed";
}