简体   繁体   English

无法通过OpenShift中的php邮件发送邮件

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

I've been trying out some php codes and I cannot able to send mail through the following code. 我一直在尝试一些php代码,但无法通过以下代码发送邮件。 I've sent some days before but now the mail() function returns true but the mail is not in the recipient's inbox. 我已经发送了几天,但是现在mail()函数返回true,但是邮件不在收件人的收件箱中。 Here's the code: 这是代码:

$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';
}

Note: I've replaced all the to address with an original address. 注意:我已将所有to地址替换为原始地址。

From the PHP mail function page 从PHP 邮件功能页面

Note: 注意:

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