dongzhong8691 2012-02-06 22:43
浏览 15
已采纳

禁用自动电子邮件日志

I am using PHP mail() function to send a mail based on my MySQL query result from a cron job at every minute interval.

All is ok, but it creates a log file for each mail automatically. Which exceeds disk space after each 2-3 days.

I haven't configured any setting for sending mails.

How can I can disable this automatic logging?

  • 写回答

1条回答 默认 最新

  • douhui2307 2012-02-09 14:56
    关注

    It's generally not a good idea to call PHP's mail() function yourself since there are so many things you can do wrong leading up to that - use a wrapper like PHPMailer or SwiftMailer instead.

    With that in place, it's possible to use their SMTP classes directly meaning emails will not go through the local mail server and thus not get logged.

    As Gryphius said, you should be rotating/compressing logs anyway - though I'm surprised if you're not since most OS packages for postfix/exim/sendmail have that already set up. Also you must have very little disk space if you're running out so quickly!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?