我有以下功能在我的php应用程序中发送邮件,当我使用测试邮件服务器工具在localhost
中进行测试时,它可以正常工作。但是当我在服务器(byethost.com)上托管我的应用程序时,成功的消息出现但我从未收到过邮件。希望有人能帮助我。
function sendPaymentApprovalMailToPayee($to,$receiver,$payno,$amount)
{
$from = $_SESSION['accemail'];
$subject = "Payment Approved #'".$payno."'";
$message = "<p>Dear ".$receiver." ,</p>
<p>We are sending this mail to confirm that the payment of ".$amount." (Pay No : #".$payno." ) has been approved and successfully transferred to your account.</p>
<p>Thanks & Best Regards,<br> Online Payment System - Team.</p>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//send email
return mail($to, $subject, $message, "From:" . $from,$headers);
}
答案 0 :(得分:0)
尝试改变
mail($to, $subject, $message, "From:" . $from,$headers);
到
mail($to, $subject, $message, "From:" . $from.$headers);