Hi,

I am using HTML Mail (7.x-2.61) with Simplenews (7.x) and the Mail System Module for sending html newsletters.

My problem is that I do not know how to assign different templates for the different email types of the the same module. The same template is used for the actual newsletter as well as for the subscription confirmation emails.

I configured the mail system to use the HtmlMailSystem for the simplenews module and placed the appropriate template file (html--simplenews.tpl.php) in my email theme folder. But this template should only be used for the emails containing the newsletter and not for the confirmation emails as well.

If this is not the right place for asking such questions please give me a hint where I could answers get instead.

Many thanks,

Heiko

Comments

pillarsdotnet’s picture

No, this is the right forum.

Newsletter template names work as follows:

htmlmail--simplenews--node.tpl.php

Newsletters delivered by email.

htmlmail--simplenews--subscribe.tpl.php

New subscriber confirmation messages.

htmlmail--simplenews--test.tpl.php

Newsletter test messages.

htmlmail--simplenews--unsubscribe.tpl.php

Unsubscribe confirmation messages.

htmlmail--simplenews.tpl.php

Default template for all simplenews messages, used when any of the above are missing.

Another approach would be to test the value of the $key variable within your htmlmail--simplenews.tpl.php template. However, mixing presentation logic with business logic in this way is generally discouraged.

If you selected a theme in your HTML Mail setup page, be sure to copy all templates (both originals and your overrides) to the corresponding theme directory.

If you selected "No theme" on the HTML Mail setup page, then put your template overrides in the HTML Mail module directory.

pillarsdotnet’s picture

Component: Code » Documentation
Assigned: Unassigned » pillarsdotnet
Category: support » task
Status: Active » Needs work

I need to copy the above information to a documentation page for future reference.

einzelkind’s picture

@pillarsdotnet: Thank you very much!

That is what I was looking for.

cheers Heiko

einzelkind’s picture

Version: 8.x-2.61 » 7.x-2.61
Status: Needs work » Closed (fixed)
pillarsdotnet’s picture

Version: 7.x-2.61 » 7.x-2.x-dev
Status: Closed (fixed) » Needs work
einzelkind’s picture

Another thing concerning this issue which took me couple of hours to comprehend: The html newsletter template htmlmail--simplenews--node.tpl.php is not used when sending test newsletters. For this purpose you have to copy your template and name it htmlmail--simplenews--test.tpl.php.

In my opinion htmlmail--simplenews--node.tpl.php should be used for test newsletters as well if there is no htmlmail--simplenews--test.tpl.php template provided.

sgurlt’s picture

Sry for reopening this after such a long time, but I actually run into problems having 2 different newsletter groups with 2 different layouts.

Is there a solution for this aswell?

Maybe something like
htmlmail--simplenews--node--{id1}.tpl.php
htmlmail--simplenews--node--{id2}.tpl.php

sgurlt’s picture

Issue summary: View changes

added module version

salvis’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)