我想知道具体如何使用 SwiftMailerHandler 之内 Monolog 包装主义者?
在里面 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归因
不隶属于 StackOverflow
scroll top