发送邮件工作与命令linux,但不与PHP


Send mail works with command linux but not with PHP

我有很多电子邮件,gmail和其他,我试着给每个人发一封电子邮件。实际上,只有一个电子邮件收到消息,另一个,例如gmail,没有。

对于linux:命令echo "Hi" | mail -s "test" xxxxxxxx@gmail.com工作正常

但是对于PHP,邮件不会到达....

我的邮件日志中没有错误。你有什么主意吗?

谢谢!

编辑:我在linux服务器上。

试试这样:

$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $mailBody;
$mail->SetFrom('xxxxxxxx@example.com'); 
$mail->AddAddress('yyyyy@example.com', 'Your Name');
$mail->Subject = 'The subject';
$mail->MsgHTML('The body');
$mail->Send();