PHP mail: how to override or bypass mail.log setting

后端 未结 4 1264
醉酒成梦
醉酒成梦 2020-12-21 12:35

phpinfo() returns this particular setting which is problematic:

mail.log    /var/log/phpmail.log

The problem is I can\'t access the phpmail

4条回答
  •  天命终不由人
    2020-12-21 13:13

    I would first try to contact whoever is managing your server, he or she should fix this problem.

    If that doesn't work, the mail.log setting is a PHP_INI_PERDIR setting, meaning that:

    Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)

    Obviously, you can't access the system's php.ini & httpd.conf, but if a .user.ini is provided to you, or you're allowed to change settings in .htaccess, then that would be a way to solve this.

    See:
    .user.ini files
    Set php.ini Values Using .htaccess

    Alternatively, you could consider using Swift Mailer or PHPMailer, which don't need the mail() function. In general, using mail() is discouraged, it's very basic and fairly difficult to use correctly & securely.

提交回复
热议问题