我目前正在尝试使用 Monolog 通过 PHP 的 native 邮件程序将未捕获的异常以 HTML 格式通过电子邮件发送给我。我收到的电子邮件很好,但 HTML 是纯文本,内容类型似乎设置为 text/plain
而我无法将 content_type 设置为 text/html
通过 yaml 配置。
我的 monolog.yaml
看起来像这样:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
system_logger:
type: native_mailer
from_email: 'Some email here'
to_email: 'my_email_address@test.com'
subject: 'Uncaught exception'
formatter: monolog.formatter.html
level: error
content_type: text/html # this is not supported?
查看 Monolog 的 NativeMailerHandler
,它确实有一个 setContentType
函数,但我如何通过 yaml 配置访问它?
最佳答案
在(未成功)尝试将 native_mailer
的 content_type
设置为 html/text
一段时间后,我刚刚切换到 swift_mailer
代替。
关于php - 无法在 Monolog 的 yaml 配置中为 native_mailer 设置 content_type?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50943638/