Log-target-email what is the proper way to define sender?

Hi

I am testing how to implement yii3 components in current yii2 projects. I started with implementing yii3 DI container and the logger with target-file and target-email.

I have managed to get target-file working ok. For target-email I defined the email dependencies based on target-email target-email package DI configuration and I have reached the point where the target tries to send the log email, but fails since the sender is missing.

I understand the log recipient is defined in the EmailTarget but I fail to find how the sender is configured or what is the proper way of doing that for the log-target-email package?

OK, since I had no replies, I’ll post here what I did to solve this.

I created my implementation for the MessageFactoryInterface, eg MyMessageFactory which allows the from to be passed to any messages created via MessageFactoryInterface (eg log-target-email). and then the di container definition has my implementation MyMessageFactory as the definition for MessageFactoryInterface

1 Like