簡體   English   中英

無法通過OpenShift中的php郵件發送郵件

[英]Unable to send mail through php mail in OpenShift

我一直在嘗試一些php代碼,但無法通過以下代碼發送郵件。 我已經發送了幾天,但是現在mail()函數返回true,但是郵件不在收件人的收件箱中。 這是代碼:

$to = "test@example.com";
$subject = "Testing Emails";
$emailBody = "Hello";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: Test <no-reply@example.com>" . "\r\n";
$headers .= "Reply-To: no-reply@example.com"."\r\n";
$mail = mail($to,$subject,$emailBody,$headers);

if($mail){    
    echo 'Successfully sent';
} else {
    echo 'Failed to send';
}

注意:我已將所有to地址替換為原始地址。

從PHP 郵件功能頁面

注意:

If messages are not received, try using a LF (\n) only. 
Some Unix mail transfer agents (most notably » qmail) replace LF by CRLF 
automatically (which leads to doubling CR if CRLF is used). 
This should be a last resort, as it does not comply with » RFC 2822.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM