Closed Graham-72 closed 1 year ago
Drupal issue https://www.drupal.org/node/1378678 "Wrong css attached if executing mail via other theme and the mimemail theme specified does not define mail.css" may also be relevant to this.
But these options do not seem to be in this Backdrop version.
These options are only available through the module mailsystem
. This module is a dependency of mimemail in Drupal 7, but this dependency was removed in Backdrop for some reason. As far as I can tell, there is no way, with mimemail
alone, to indicate which theme the email should use. Only when you enable mailsystem
can you do that.
I will be checking to see if this issue persists with mailsystem enabled. If it does, then this is probably an issue with mailsystem
and not with mimemail
After some testing, I can verify that mailsystem
does not respect the "Theme to render rich text emails" setting. It uses the template of the page's theme based on the URL.
I'll open an issue in that module.
I believe this can be closed here.
Well, it turns out it's a bit more complicated than I thought, and the issue is indeed with Backdrop's version of mimemail
. See my issue in mailsystem: https://github.com/backdrop-contrib/mailsystem/issues/28
It looks like the mailsystem feature "Theme to render rich text email" only works if the key mail theme
exists in the theme definition that's supposed to theme the email outer wrapper. This key is actually set in mimemail (see mimemail_theme_theme()
where that key is set to TRUE).
So, it looks like the issue is indeed with Backdrop's version of mimemail. D7's version gets the mailsystem setting for the mail theme in template_preprocess_mimemail_message()
(line 35 in the D7 version), but this was eliminated in Backdrop's version of mimemail.
Since Backdrop's mimemail doesn't depend on mailsystem, this call to mailsystem_get_mail_theme()
has to be wrapped with an if statement. I'll create a PR tomorrow for this.
PR #42
To test:
admin/config/system/mailsystem
and set up the default to Mime Mail. While there, select a specific theme in "Theme to render rich text emails" mail.css
file in both your default and admin themes folders. Make them slightly different to be sure you can identify the source later in the email<style>
tag to check which mail.css was included in the emailadmin/config/system/mailsystem
and switch to the the other themeI haven't tested this with Simple Mail System, only with the full Mail System.
As reported by @thekenshow at https://github.com/backdrop-contrib/views_send/issues/9 if a mail message is generated by Views Send from a page using the admin theme, Mimemail looks for the template in the admin theme and not in the current site theme.
The readme.txt for the Drupal module says: Messages can be rendered using different themes. You can choose the following settings to render the email: 'current': Theme currently used by the user who runs drupal_mail(). 'default': Default theme, obtained via variable theme_default. 'domain': Theme obtained via Domain Theme module. or any other active theme.
But these options do not seem to be in this Backdrop version.