You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to customize the way Laravel composes my email messages. For example, I'd like to encode the message and embedded text files with base64 (because default quoted-printable encoding wastes too much space with non-ascii text).
Unfortunately, Laravel/Illuminate hooks for customizing SwiftMessage are applied too late, after many properties of message are set in stone.
The code above successfully encodes attachments, but primary message body (contained in _mail.sample_email') is still encoded in quoted-printable instead of base64.
This appears to happen because Illuminate\Mail\Mailercalls user-supplied callbackafter invoking addContent on SwiftMailer message.
Perhaps, I might be able to implement my custom mailer, and/or muck around with internal structure of SwiftMessages but that's way too much setup to customize few emails.
Seems like the ability to customize emails is more or less broken, so maybe there is no harm in changing the code to invoke call_user_func a couple lines earlier.
The text was updated successfully, but these errors were encountered:
Description:
I am trying to customize the way Laravel composes my email messages. For example, I'd like to encode the message and embedded text files with base64 (because default quoted-printable encoding wastes too much space with non-ascii text).
Unfortunately, Laravel/Illuminate hooks for customizing SwiftMessage are applied too late, after many properties of message are set in stone.
Steps To Reproduce:
I have extended the
Mailable
class:Unfortunately, the code above does not accomplish anything (the non-ascii parts of mail are still encoded with quoted-printable).
Quick research shows, that
send
function ofMailable
is callingrunCallbacks
after the message is already built.Here goes a second try: I override
send
and try to register callbacks as early as possible:The code above successfully encodes attachments, but primary message body (contained in
_mail.sample_email'
) is still encoded in quoted-printable instead of base64.This appears to happen because
Illuminate\Mail\Mailer
calls user-supplied callback after invoking addContent on SwiftMailer message.Perhaps, I might be able to implement my custom mailer, and/or muck around with internal structure of SwiftMessages but that's way too much setup to customize few emails.
Seems like the ability to customize emails is more or less broken, so maybe there is no harm in changing the code to invoke
call_user_func
a couple lines earlier.The text was updated successfully, but these errors were encountered: