有没有办法使用 PHPmailer 默认 from as sendmail_from php.ini 指令?
Is there a way to use PHPmailer with default from as sendmail_from php.ini directive?
我想将 PHPmailer 与我的 php.ini sendmail_from 指令一起使用,但我没有找到这样做的方法:PHPmailer 总是采用他自己的默认配置 (root@localhost)。
有没有办法获取 PHP.ini 中指定的值,然后在 PHPmailer 中将其作为默认值检索?哪一个 ?
感谢您的回答!
感谢 Martin Barker 的评论,这是我所做的:
我创建了一个继承自 PHPmailer 的新 class,然后在 __construct 函数中我这样做了:
$this->From = ini_get('sendmail_from');
$this->FromName = ini_get('sendmail_from');
并且有效。可能有更好的方法来执行此操作,但暂时可以解决问题。
我想将 PHPmailer 与我的 php.ini sendmail_from 指令一起使用,但我没有找到这样做的方法:PHPmailer 总是采用他自己的默认配置 (root@localhost)。 有没有办法获取 PHP.ini 中指定的值,然后在 PHPmailer 中将其作为默认值检索?哪一个 ? 感谢您的回答!
感谢 Martin Barker 的评论,这是我所做的:
我创建了一个继承自 PHPmailer 的新 class,然后在 __construct 函数中我这样做了:
$this->From = ini_get('sendmail_from');
$this->FromName = ini_get('sendmail_from');
并且有效。可能有更好的方法来执行此操作,但暂时可以解决问题。