I've tested this on a barebones install just to make sure.

Somewhat related to this issue but this is about 7.x and the normal tpls are called fine but not the views tpls unless you use the admin theme. At first I thought it was a mimemail issue so I tried htmlmail and got the same result.

I've tested this on every combination of the following modules: htmlmail mimemail smtp phpmailer.

Comments

Stevel’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new2.64 KB

The attached patch changes the theme temporarily, so that while building the newsletter content, the theme from Mail System is used. This may also solve #1899092: Respect MailSystem theme setting for referenced content.

Status: Needs review » Needs work

The last submitted patch, 1813350-use-theme-for-content-1.patch, failed testing.

Stevel’s picture

Status: Needs work » Needs review
StatusFileSize
new2.64 KB

path_to_theme obviously doesn't give the theme name. Using $GLOBALS['theme'] now.

shaneonabike’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that this patch resolves my issues that were previously reported at #1876478: Simplenews not calling field theme functions. I tested it and it's working great!

Specifically, for my case all the custom code in my theme layer was never being called b/c it was using the admin theme template.php rather then the live site theme.

wucherpfennig’s picture

I applied the patch from above and it does not seem to work. It is only working properly when not using an admin theme.

Stevel’s picture

wucherpfennig: did you clear the cache after applying the patch? It's possible the page for anonymous users is still cached with the old theming applied.

wucherpfennig’s picture

yes, I tried that too... yesterday I almost lost my nerves because I finally got emogrifier (https://drupal.org/node/1336106) working and then this theme thing came up... luckily I am not in a hurry to set up a real newsletter project (just evaluating right now) because it seems to be almost impossible to find a working, reliable way sending newsletters with drupal...

shaneonabike’s picture

Could you expand on your comments? Or provide some debug stuff to help out ... it worked super well for me and I would love to get this rolled into the next release?

shaneonabike’s picture

@wucherpfennig: bump

I kind of wonder if the reason that the admin theme won't work is due to access permissions. Specifically, anonymous users may not be able to use it if it's setup as the admin theme. What happens if you set your admin theme as default but not set as default admin theme.

shaneonabike’s picture

Alright the site I was working on started having this issue again. Then after (thinking about the comment above reported by someone else) I realized that perhaps it had to do with the overlay.

I disabled that in my user account and viola! It sent out the test emails properly again with all the appropriate theming.

Not sure how we can fix that in this patch but that might help others testing.

info@cgfix.com’s picture

Issue summary: View changes

the patch no longer works and this is still a problem in the latest release. SimpleNews is a nice module but this is a problem for theming elements. this is also a problem when using the 'Simplenews Content Selection' Module when themeing the 'scs' view mode. I would suggest adding theme support in your module and not relying on the mail system. Currently, the Administration theme has to be set to what ever theme is needed for the mail to work or adding theme files to administration theme as well.

**** I found a simple solution ******
Since the problem exists due to simplenews using the theme active on the send page, I used the module ThemeKey to set my admin theme ( with admin theme under appearance set to default ) and set the theme of the page that sends the newsletter (node/#/simplenews) to the theme where the theme files are.

though, this may may not work with caching modules enabled such as boost (not tested yet)?

dreamer777’s picture

are there any solutions so fur for current release:

I see this problem in two cases:

- sending email from admin page
- running cron on admin page

Changing both pages to deault theme with Page Theme module solves the problem. But it is a very dirty trick.
How to make Simplenews always use defaul theme?

bisonbleu’s picture

Sorry if my post appears somewhat unrelated to this issue. But I too struggled quite a bit with Simplenews templates in order to create HTML emails.

In the end, the combination of the following worked great for me.

  • Mimemail: [√]Link images only + Full HTML
  • Mailsystem:
    • Site-wide default: DefaultMailSystem
    • Simplenews module class: MimeMailSystem__DefaultMailSystem
    • Theme to render the emails: Default or your_theme
  • All your CSS should be in /sites/all/themes/your_theme/mail.css
  • No templates required!
  • The required html (DIVs + classes) is added in a Views Global custom text rewrite
wylbur’s picture

Comment indicates that this issue needs work so changing the status accordingly.

wylbur’s picture

Status: Reviewed & tested by the community » Needs work