Problem/Motivation
Using 1.1.0-beta2 version
I have functionallity to preview emails before it's send. With old mailer, after calling mail() method with prameter "send" to FALSE, i got still get rendered body in message array. Now using symfony mailer we get return boolean and no content. I need to get email body and not actually send mail.
There is a method in MailManagerReplacement class mail() and there LegacyHelper->emailToArray() is called. That method should set, as I understand, extra message parameters like body and headers. But emailToArray doesn't take message parameter as reference so message array is actually never updated.
Steps to reproduce
Send mail using mail manager method send(), setting send parameter to FALSE. Returns array with parameters without email content
Proposed resolution
I found way to get body of email without sending it, bet I need LegacyHelper->emailToArray() to actually change the message array for that. Now I have seperate email builder which sets transportDsn to "null://default", so email isn't sent. And in my message string I get body if I set LegacyHelper->emailToArray() second argument with reference.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | symfony_mailer-get_body_after_send-3317709-2.patch | 1.09 KB | ugas19 |
Comments
Comment #2
ugas19 commentedComment #3
adamps commentedGreat thanks. This was caused by #3315698: Improve back-compatibility, call hook_mail_alter().
Comment #4
adamps commentedComment #6
adamps commented