oc-mail
oc-mail copied to clipboard
Doesn't work, no error
Doesn't work, and no error found. What's wrong? I use PHP mail. The email is successfully sent, but no log there.
Unfortunately, it doesn't work. Tested via smtp and AWS SES. Mail has been sent, but no log items, no hidden images in mail body.
There is a bug in Rainlab.User (at least in 1.2.1) plugin that blocks all subscribers for event 'mailer.prepareSend'. That's why this plugin will not work.
Replace this in Rainlab.User Plugin.php
Event::listen('mailer.prepareSend', function($mailer, $view, $message){ return MailBlocker::filterMessage($view, $message); });
with this
Event::listen('mailer.prepareSend', function($mailer, $view, $message){ return MailBlocker::filterMessage($view, $message) ? null : false; });
There is also bug in October core, it returns error:
[2016-04-23 20:02:48] dev.ERROR: exception 'ErrorException' with message 'Missing argument 6 for Illuminate\Database\Eloquent\Relations\HasManyThrough::__construct(), called in /usr/local/www/data/mysite.com/beta/vendor/october/rain/src/Database/Relations/HasManyThrough.php on line 22 and defined' in /usr/local/www/data/mysite.com/beta/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php:52
I already reported at https://github.com/octobercms/library/issues/209
So it also doesn't work for me, zero logged e-mails at all.
@bashorgru I'm having trouble seeing why this code change is necessary? The mail.prepareSend
event will only halt if the value returned is === false
, so these changes should not make any difference? Please submit a PR to the user plugin to discuss further.
Let's figure it out. It's simple. First, \October\Rain\Mail\Mailer fire event 'mailer.prepareSend' with halt flag (code). Next, \Illuminate\Events\Dispatcher as Event start propagating event through listeners, call that function setted from \Rainlab\User\Plugin and then stop propagating to the rest of listeners. Propagating stopped because that function returns a result (boolean). But it should return null to allow processing the rest of listeners (read comments here). I assume it's a bug in Rainlab.User. Issue link.