I'm currently trying to use Monolog to email me uncaught exceptions formatted as HTML using PHP's native mailer. I receive the emails just fine but the HTML is in plain text, it seems the content type is set to text/plain
and I am unable to set the content_type to text/html
via the yaml configuration.
My monolog.yaml
looks like this:
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?
Looking at Monolog's NativeMailerHandler
, it does have a setContentType
function, but how do I access this via the yaml configuration?
After (unsuccessfully) trying for some time to set the content_type
to html/text
for the native_mailer
, I just switched to the swift_mailer
instead.