PayPal IPN显示正常,但sendmail不会发送电子邮件

On the PayPal IPN simulator, it shows that "IPN was sent and the handshake was verified.".

My IPN works, but the code in it doesn't.

<?php namespace Listener;
error_reporting(E_ALL); // To investigate errors, 100% useless
ini_set("log_errors", TRUE); // To investigate errors, 100% useless
ini_set("error_log", "/tmp/php-error.log"); // To investigate errors, 100% useless
require('PaypalIPN.php');
use PaypalIPN;
$ipn = new PaypalIPN();
$ipn->useSandbox(); 
$verified = $ipn->verifyIPN();
if ($verified) {
$to      = 'xxxxxxxxxx';
$subject = 'xxxxxxxxxx';
$message = 'xxxxxxxxxx';
$headers = 'From: xxxxxxxxxx' . "
" .
'Reply-To: xxxxxxxxxx' . "
" .
mail($to, $subject, $message, $headers); //supposed to send an email when someone successfully donates
}
header("HTTP/1.1 200 OK");

I also tried sendgrid and it didn't work either. Nothing shows up in PHP error logs.

The thing that kills me is that the mail code works outside of the if statement.