使用Laravel邮件类时如何设置SwifMailer插件? [英] How to set SwifMailer plugins when using the Laravel mail class?

查看:56
本文介绍了使用Laravel邮件类时如何设置SwifMailer插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Laravel不返回任何有用的信息来显示电子邮件失败的原因.SwifMailer 记录器插件可帮助在发送过程中进行调试.通过Laravel的Mail类发送电子邮件时,设置此插件(和其他swifmailer插件)的正确方法是什么?

Laravel does not return any useful information to show the reason that email fails. The SwifMailer Logger plugins helps with debugging during the process of sending. What is the correct way to set this plugin (and other swifmailer plugins) when emails are sent through Laravel's Mail class?

推荐答案

使用

Mail::getSwiftMailer()->registerPlugin();

您可以将此代码放入某些服务提供程序中,例如在应用程序启动时执行.或者,您可以根据需要完全覆盖 Illuminate \ Mail \ Mailer .

You can place this code into some service provider for example to be executed on application startup. Or you can override Illuminate\Mail\Mailer entirely if you want.

这篇关于使用Laravel邮件类时如何设置SwifMailer插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆