繁体   English   中英

如何使用swologmailer处理程序与monolog

[英]how to use swiftmailer handler with monolog

我想知道究竟如何使用SwiftMailerHandlerMonolog packagist?
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;
}  

但我仍然不知道如何设置上面提到的\\Swift_Mailer $mailer
我应该做其他任何步骤/配置吗?

对不起,如果我的问题非常基本。
谢谢。

您需要查看Swift_Mailer文档,了解如何设置邮件程序。

https://swiftmailer.symfony.com/docs/sending.html

一旦你设置了邮件程序,就应该传入$ mailer变量的新SwiftMailerHandler()。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM