Open pmhou opened 7 years ago
I'm sorry to hear you have a problem with Error Logger plugin. I just cloned fresh OctoberCMS master branch, keep config files with default values, install Error Logger plugin and set plugin like this:
Then fire a error in template:
And got mail to my mailbox in a few seconds:
I recommend you try to send Log::error with PHP mail
method, to eliminate Mailgun misconfiguration. Also check mail.pretend config value to be false
.
My Mailgun settings are definitely correct as I can trigger emails using the Mail facade no problem. I have also changed my settings to use PHP Mail, Log file and SMTP - all of which successfully send emails, just not when an error is triggered.
I can confirm mail.pretend is set to false.
Are you using some other Loggers? Slack, Syslog, New Relic, Sentry, Bugsnag? Maybe some other Logger "steals" the logged data.
Now I tried a combination of Mail logger and Slack logger and both works well:
So I don't know where could be your problem. I can't reproduce your issue. Could you please put your project somewhere to the Git, where I can try it? Let me know directly to email please. Thanks.
I've just had the opportunity to look at this again. It appears that your plugin only uses PHP's mail() method to send email. Is that correct?
Yes, you are right. This plugin uses Monolog/NativeMailerHandler
, which uses plain mail()
function to send e-mails:
https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/NativeMailerHandler.php#L140
I didn't realise that was the case when I posted this issue. Native mail is not set up by default with Laravel Homestead which was causing the issue. I assumed whichever mail method specified in the October settings would be used.
Me niether. I also thought that NativeMailerHandler using Laravel Mail function, so you can configure mail/smtp etc.
I have to update documentation.
@vojtasvoboda do you have any plans to utilize the default mail driver configured for the application to send error messages instead of the built in mail() method? The mail()
method in PHP is inherently insecure and potentially vulnerable, in fact SwiftMailer has dropped support for it entirely.
@LukeTowers this plugin only register Monolog\Handler\NativeMailerHandler
to the OctoberCMS. So all the magic is in this handler and there is no way how to inject own mail sender or configure sending.
So I've prepared integration of Monolog\Handler\SwiftMailerHandler
, which using OctoberCMS Swift mailer: https://github.com/vojtasvoboda/oc-errorlogger-plugin/pull/7
I tried it now with Mailtrap.io configured in OctoberCMS Mail settings and seems to works. Could you please test it? Thanks a lot
@pmhou Hi Pete, there is new Swift Mailer handler, so now you can use OctoberCMS mail configuration. Could you please test it? Thanks a lot
I have my mailer settings set up and working with Mailgun credentials.
I've set logging level to 100 and unchecked 'Disable when debug' and triggered an error with
Log::error('Test');
The error is written to the system log file and appears in the Event Log but no email sent.