How do I get a view to display as themed within a simplenews html email? I am trying to create a simplenews newsletter, also using Simplenews Scheduler, to weekly send out a newsletter with the content defined by views.

I have a content type set up, and the views defined. I have the views inserted into the content type using Viewfield. This all works fine and the email sends with the views content. However, the styling is not correct.

My views return lists of full nodes which I have set the View Mode of as "Email: HTML". Within the templates in my theme I have added the mark-up I want for the node with that View Mode. When viewing the newsletter on the site (as a node) it all looks correct. However, when I send the newsletter, the email I receive has the view in it's raw format (like that which is displayed in the view preview) and has none of the mark-up I've specified.

How can I get the correct mark-up showing? I don't know if I'm just missing a setting somewhere or something.

Many thanks.



My newsletter template (simplenews-newsletter-body--13--email-html.tpl.php) is as follows:

&lt;?php /*This appears in the email*/ ?&gt;
TEST NEWSLETTER TEMPLATE
&lt;div&gt;
    &lt;?php /*The following should print the full newsletter node including the views*/ ?&gt;
    &lt;?php print render($build); ?&gt;
&lt;/div&gt;
&lt;div&gt;
    &lt;?php /*The following should print a single view*/ ?&gt;
    &lt;?php print views_embed_view('news_upcoming_events','block_1'); ?&gt;
&lt;/div&gt;


The event node template (node--event.tpl.php) which is returned in the view used in the newsletter template:

&lt;?php if($view_mode == 'email_html'){ ?&gt;
    TEST EMAIL TEMPLATE
    &lt;div&gt;
        &lt;h3&gt;&lt;a href="&lt;?php print $node_url; ?&gt;"&gt;&lt;?php print $title; ?&gt;&lt;/a&gt;&lt;/h3&gt;
        &lt;div&gt;&lt;?php print render($body); ?&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;?php }else{ ?&gt;
    NORMAL VIEW
&lt;?php } ?&gt;


The newsletter template all appears fine in the email. I see the line TEST NEWSLETTER TEMPLATE, but the event node templates are not used in the views output. It is instead some generic drupal/views output.



This is the way the view is setup.



And this is the preview displayed with in the view setup. This is also what is appearing in the email when the newsletter is sent, instead of the mark-up declared in my template file. (It is correct when viewing the node on the website though)
This sounds very similar to what I did a while ago. I documented my setup on drupal.org. This seems to work for your already. I think your MailSystem is the source of error here. Make sure the MailSystem that is used by Simplenews is using the required style sheets and of course the custom templates from your web theme. Also note, that not all styles that are possible on a website an be used in an email, in fact, only a pretty small subset of styles will work at all.

Take a look at the Emogrifier module, it converts your stylesheets to inline styles for emails. Also, for images and other URLs, the Pathologic module may be of help as it converts relative URLs to absolute ones.