Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have mails sent via cron with CSS from my custom theme -- "foo".
If I execute cron manually via admin/config/system/cron where the theme is "seven", I get wrong CSS in the mail. My quick solution is to hook_custom_theme() the cron page to "foo", but that's a workaround ;)
Comment | File | Size | Author |
---|---|---|---|
#5 | 1378678.patch | 3.39 KB | jherencia |
Comments
Comment #1
jherencia CreditAttribution: jherencia commentedLet me check this.
Comment #2
sgabe CreditAttribution: sgabe commentedThis can be easily a duplicate of #1349728: Possibility to configure the theme that will render the email.
Comment #3
jherencia CreditAttribution: jherencia commented@Amitaibu
Has the dev version you have installed that patch applied?
I've been checking about the css and it works with cron too, so if in case you have a dev version with that issue, could you describe exactly how to reproduce?
Comment #4
jherencia CreditAttribution: jherencia commentedOk, talking to @amitaibu in IRC I've found the problem.
The css attached to the email, when no mail.css is declared, is generated using the current theme not the specified in the setting.
I'm going to work on this.
Comment #5
jherencia CreditAttribution: jherencia commentedI think this is the best way, I have some other things in mind about the general aproach of theming mails with non-current themes but I would like to discuss with @berdir, @pillarsdotnet and @sgabe.
I'm caching the results to improve performance, maybe it would be good to do the same with template_preprocess_mimemail_message in the generation of the output css, but probably better in another issue.
Let's see if this works.
Comment #6
cimo75 CreditAttribution: cimo75 commentedWas this ever included in the release?
Comment #7
AnybodyI don't think so because the problem still seems to exist. Even when using mail system the problem seems to occur.
Comment #8
sgabe CreditAttribution: sgabe commentedDoes the patch solve the issue?
Comment #9
AnybodyPerhaps this problem has a connection to #854342: HTML not being rendered "randomly". I did not test the patch yet, because it is quite old and I want to make sure first, that I can find the deeper reasons to the problem. Anyway #854342: HTML not being rendered "randomly" seems closer to the problem in my case, so I will first have a look there.
Comment #10
amaisano CreditAttribution: amaisano commentedFYI this patch does not work in the latest module (7.x-1.0-beta4).
Before, when I explicitly set the 'Theme to render the emails' to my custom theme 'foo,' it still uses the admin theme ('Seven'), even though I've set my default theme to 'foo' as well.
After this patch, it doesn't attach *any* CSS.
I'm running cron using the admin menu as a logged in admin.
Comment #11
sgabe CreditAttribution: sgabe commentedUpdating issue status.