monolog-bundle icon indicating copy to clipboard operation
monolog-bundle copied to clipboard

Monolog with Symfony Mailer fails on multiple mail receiver when pass mails as the environment value

Open ahmetcelikezer opened this issue 4 years ago • 5 comments

Hi,

I tried the create mail notifications that sending on application fail 50x, so I want to send this notification to 2 different developers and I defined the environment value in .env like this:

    [email protected],[email protected]

and the monolog configuration is like this:

symfony_mailer:
    type: symfony_mailer
    from_email: '%env(EXCEPTION_MAIL_SENDER)%'
    to_email: '%env(csv:EXCEPTION_NOTIFICATION_MAILS)%'
    subject: 'An Error Occurred on Project X! %%message%%'
    level: debug
    formatter: monolog.formatter.html
    content_type: text/html

then the application fails.

Invalid type for path "monolog.handlers.symfony_mailer.to_email.0". Expected one of "bool", "int", "float", "string", but got "array".

Same error throws on JSON parser... Am I defining values as malformed or is this a bug/unsupported usage?

ahmetcelikezer avatar Nov 19 '20 08:11 ahmetcelikezer

same problem

Lephin avatar Jan 28 '21 08:01 Lephin

Same here in SF 5.4

ioniks avatar Mar 04 '22 10:03 ioniks

Same here in 6.3, while it's specifically mentionned in the documentation that passing an array of emails is allowed:

https://symfony.com/doc/current/logging/monolog_email.html

geoffroyp avatar Sep 15 '23 16:09 geoffroyp

I think this is related to using an env placeholder instead of a build-time array here.

stof avatar Sep 15 '23 16:09 stof

yes, using an array directly in yaml is indeed working. The problem really is when it comes to using a .env variable as @ahmetcelikezer mentionned

geoffroyp avatar Sep 18 '23 07:09 geoffroyp