Fir*_*yat 6 php handlers swiftmailer monolog
我想知道如何SwiftMailerHandler在Monologpackagist 中使用?
在Monolog文档中,我没有看到任何使用示例,SwiftMailerHandler或者我可能错过了。
下面是SwiftMailerHandler构造函数代码:
/**
* @param \Swift_Mailer $mailer The mailer to use
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
* @param integer $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/
public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
{
parent::__construct($level, $bubble);
$this->mailer = $mailer;
if (!$message instanceof \Swift_Message && is_callable($message)) {
$message = call_user_func($message);
}
if (!$message instanceof \Swift_Message) {
throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it');
}
$this->message = $message;
}
Run Code Online (Sandbox Code Playgroud)
但我仍然不知道如何设置\Swift_Mailer $mailer上面提到的。
我应该做任何其他步骤/配置吗?
对不起,如果我的问题很基本。
谢谢。
您需要查看 Swift_Mailer 文档以了解如何设置邮件程序。
https://swiftmailer.symfony.com/docs/sending.html
设置好邮件程序后,您应该将其传递到 $mailer 变量的新 SwiftMailerHandler() 中。
| 归档时间: |
|
| 查看次数: |
2694 次 |
| 最近记录: |