When the code is invoked via Drush Mailsystem crashes with next error.
Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call.
The problem is in render() method which requires a context, which is not exist while running via Drush.
Related issue: https://www.drupal.org/node/2549835
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | mimemail-render-ajax-2801187-17.patch | 508 bytes | jerdavis |
| #3 | mimemail-render_drush-2801187-3.patch | 870 bytes | danylevskyi |
Comments
Comment #2
danylevskyiI have a solution now. Working on a patch...
Comment #3
danylevskyiComment #4
danylevskyiComment #5
danylevskyiComment #6
danylevskyiComment #7
Jill LI was having the same issue, trying to send email during a cron run.
This patch resolved that issue.
I think renderRoot instead of render is the right way to go, I'm going to mark this as reviewed.
Comment #8
Jill LComment #10
sgabe commentedCommitted, thanks!
Comment #12
audriusb commentedthis is still a problem. when adding Mail handlers to webform and submitting webform via ajax - I get
LogicException: A stray renderRoot() invocation is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->renderRoot()Comment #13
klemendev commentedThis issue needs to be reopened as the problem is still present when the mail sending is triggered by AJAX. I use Comment Notify with AJAX Comment and when a comment is written, the exception is thrown and the comment is not sent.
EDIT1: Practically the same issue was fixed here: https://www.drupal.org/project/swiftmailer/issues/2825362. I think there is only a minor change inside MimeMail.php required to fix this.
EDIT2: I can confirm that changing renderRoot to renderPlain in MimeMail.php fixed the issue.
Comment #14
rick.kowal commented"EDIT2" in #13 worked for me as well. I created a simple patch locally based on the patch in #3. Not sure if this is worth uploading.
Comment #15
klemendev commentedSomeone reopen this issue, as it was not fixed yet. We need a patch and have it reviewed. Is there any active contributor who could do this?
Comment #16
klemendev commentedJust a small bump, is there any active contributor that could get this patch in a release?
Comment #17
jerdavisUploading a patch with this change. Please test & confirm.
Comment #18
klemendev commentedI can confirm patch #17 works for me and fixes the issue I described in #13.
Comment #19
klemendev commentedIs there any maintainer that could get this into a release?
Comment #20
jerdavisComment #22
jerdavisCommitted & pushed to 8.x-1.x