cron ジョブを (適切に) 実行するのに問題があります。
mail() を呼び出す php ページ (非常に大きいが、無駄に削ぎ落とされた) を作成しました。
<?
mail('my@email.com', 'subject', 'test');
mail('other@address.com', 'subject', 'test');
?>
次に、ファイルを実行する cron ジョブを作成しました。crontab -e のコード行は次のとおりです。
12 0 * * * /opt/lampp/bin/php /opt/lampp/htdocs/atlantis/application/controllers/cron.php
コマンド /opt/lampp/bin/php /opt/lampp/htdocs/atlantis/application/controllers/cron.php をターミナルから実行すると、自分宛にメールが送信されます。ただし、cron ジョブから同じ行を実行しても機能しません。
私の次の目的地は、ログを確認することでした。sSMTP で Ubuntu を実行しています。
Apr 16 11:49:17 drew-Virtual crontab[4722]: (drew) END EDIT (drew) //EDITED CRON
//Calling cron.php file from terminal
Apr 16 11:49:31 drew-Virtual sSMTP[4791]: Creating SSL connection to host
Apr 16 11:49:32 drew-Virtual sSMTP[4791]: SSL connection using RSA_AES_128_CBC_SHA1
Apr 16 11:49:34 drew-Virtual sSMTP[4791]: Sent mail for drew@drew-Virtual (221 ip-173-201-180-143.ip.secureserver.net closing connection) uid=1000 username=drew outbytes=444
Apr 16 11:49:34 drew-Virtual sSMTP[4794]: Creating SSL connection to host
Apr 16 11:49:35 drew-Virtual sSMTP[4794]: SSL connection using RSA_AES_128_CBC_SHA1
Apr 16 11:49:37 drew-Virtual sSMTP[4794]: Sent mail for drew@drew-Virtual (221 ip-173-201-180-143.ip.secureserver.net closing connection) uid=1000 username=drew outbytes=454
//I successfully received 2 emails, one to my work account, one to my personal account
//Calling cron.php from cron
Apr 16 11:50:01 drew-Virtual cron[857]: (drew) RELOAD (crontabs/drew)
Apr 16 11:51:01 drew-Virtual CRON[4808]: (drew) CMD (/opt/lampp/bin/php /opt/lampp/htdocs/atlantis/application/controllers/chron.php)
Apr 16 11:51:01 drew-Virtual sSMTP[4810]: Creating SSL connection to host
Apr 16 11:51:02 drew-Virtual sSMTP[4810]: SSL connection using RSA_AES_128_CBC_SHA1
Apr 16 11:51:04 drew-Virtual sSMTP[4810]: Sent mail for drew@drew-Virtual (221 ip-173-201-180-143.ip.secureserver.net closing connection) uid=1000 username=drew outbytes=698
//I did not receive any emails
メールを 1 通だけ送信しようとしていることがわかりますが、受信していないので失敗したと思います。ただし、失敗した理由はわかりませんし、他の手がかりもありません。また、コマンドラインよりも cron ジョブの方が outbytes が大きいことにも気付きました。
最後に、php ファイルには、すべてのユーザーに対して完全な rwx パーミッションがあります。