Nothing in the documentation for Mail System or HTML Mail explains where the $key value comes from. I am using OG, Mailhandler, HTML Mail to notify group members of new posts to the group. I have several groups, each of which has a group nid.

Can I use the group nid as a key so that each group uses a different template, i.e.

htmlmail-og-1.tpl.php
htmlmail-og-2.tpl.php
...

Some of my groups are moderated and Rules sends a message to moderators that a new post is waiting to be published. The post goes into a group but the rule sends the email. Do I need to select Rules as the mail system to get the right template for the moderator message? If so, is the $key the machine-readable name of the rule, i.e. rules_mods?

Comments

pillarsdotnet’s picture

Status: Active » Fixed

The key value comes from the second parameter to the call to drupal_mail().

The latest version of htmlmail has improved debug info in the htmlmail.tpl.php file. Upgrade if you haven't already, then try checking the "Debug" box in the htmlmail module settings page and re-sending your message. It should give you all the information you need.

Or click on the "Instructions" link on the same settings page. It has lots of good info.

Marking "fixed" for now. If you try all of the above and still can't figure it out, please re-open and also give me a clue as to what more I could have done in the way of documentation.

Also see #1122790: Create a "Mail Handler" template.

pillarsdotnet’s picture

By the way, the documentation in both the htmlmail.tpl.php file and the htmlmail.admin.inc file comes from the same source file. If you want to help improve the documentation, please file a patch against that file; thanks.

pillarsdotnet’s picture

Title: $key value??? $module choice?? » Explain the relationship between the various modules used by HTML Mail
Project: Mail System » HTML Mail
Version: 6.x-1.11 » 6.x-2.x-dev

This is an HTML Mail issue, not a Mail MIME issue.

Note to self: write a document explaining the interrelationship of all these modules...

pillarsdotnet’s picture

Status: Fixed » Needs work
pillarsdotnet’s picture

Assigned: Unassigned » pillarsdotnet
Category: support » task
rsbecker’s picture

I have a somewhat related question, but don't know whether it belongs here or in mailsystem. In my setup Mailhandler receives an email and creates a node that is an OG post. It then uses Messaging and Notifications to send out the post to members of the group using HTML Mail to format the message and PHPMailer to send it.

When I set up mailsystem which module do I select as the one mailsystem needs to know about? OG, Messaging, Notifications, HTML Mail or PHPMailer? Messaging templates are used, as well as the HTML Mail template.

pillarsdotnet’s picture

@rsbecker -- I remember working to improve debugging info in the htmlmail.tpl.php file in response to your earlier bug report:

  1. Upgrade to latest HTML Mail and Mail System if you haven't already
  2. Set HTMLMailSystem as the site-wide default mailer, at least temporarily.
  3. Go to your admin/settings/htmlmail page and check the Debug checkbox.
  4. Send your email and look at what is received at the other end.

-- OR --

Find the code that actually sends the email and look at the first two arguments to drupal_mail(). The first one is the $module and the second one is the $key.

rsbecker’s picture

I've followed all the steps in #7 but I'm getting no debug info, whether the box is checked or not. I have repeatedly cleared the cache, so that's not the problem. I have tried with MimeMail and PHPMailer set as the default mail agent. My email is coming out formatted OK, but the header and footer I put in the tpl files are not appearing, only the parts included in the messaging template.

I have gone to Messaging Settings>Test and sent test emails using Mail, Mime Mail and HTML Mail, and all I get is the body of the message, no formatting, headers, footers, etc.

6.x.1.x worked fine with this system, but Messaging Module appears to completely circumvent 6.x.2.x.

pillarsdotnet’s picture

Title: Explain the relationship between the various modules used by HTML Mail » HTML Mail is incompatible with Mime Mail.
Component: Documentation » Module compatibility
Category: task » bug

At the moment, I highly suspect that the d6 version of Mime Mail is incompatible with HTML Mail, and will stay that way.

I created the Mail System module so that different mail-sending modules could peacefully co-exist, but the Mime Mail maintainers don't want it that way.

See #1088914: The Mime Mail module should use the Mail System module

pillarsdotnet’s picture

Title: HTML Mail is incompatible with Mime Mail. » HTML Mail is incompatible with Mime Mail, because Mime Mail wants it that way.
rsbecker’s picture

Progress!!!

After removing mimemail HTML works under some conditions. It gave me the debug info about creating two tpl files, htmlmail-messaging.tpl.php and htmlmail-messaging-message-notifications.tpl.php. This raises a question. Am I supposed to put the nameplate and footer in the htmlmail-messaging.tpl.php file and use the htmlmail-messaging-message-notifications.tpl.php for the body of the message or digest. If so, that is more like the old htmlmail template system, where you could put the nameplate, footer and css into the form on the Template tab and the Messaging Module provided the body.

There is another issue. It only uses the tpl files if I set the subscription to use Mail as the send method. If I set it to use HTML Mail in the subscription I get formatted body text from the Messaging template, but no header & footer.

In addition, if I set the Email Theme dropdown to my site's theme directory the header and footer from page.tpl.php are pulled into the email in addition to the header and footer in the appropriate htmlmail.tpl.php file. If I set to No Theme and put the tpl files in the htmlmail directory I get only the email header and footer.

pillarsdotnet’s picture

Re:

Am I supposed to put the nameplate and footer in the htmlmail-messaging.tpl.php file and use the htmlmail-messaging-message-notifications.tpl.php for the body of the message or digest.

No, only the most specific template will be used.

If I set it to use HTML Mail in the subscription I get formatted body text from the Messaging template, but no header & footer.

I'm quite sure that the words "HTML Mail" as used in the messaging framework do not pertain to this module. Probably messagingi provides its own mail-sending method instead of drupal_mail(). I can't really do anything about that.

In addition, if I set the Email Theme dropdown to my site's theme directory the header and footer from page.tpl.php are pulled into the email in addition to the header and footer in the appropriate htmlmail.tpl.php file. If I set to No Theme and put the tpl files in the htmlmail directory I get only the email header and footer.

That is by design. If you remove or disable the Echo module then this theme-wrapping will not occur.

Have you by any chance read the documentation on the project page, the README.html, and the module settings page?

I have been diligently trying to communicate the concept that, if you select a theme, and the Echo module is enabled, then your selected theme will be used to format your messages.

Apparently I have failed in this communication. Can you suggest a more effective way that I could have communicated this point?

pillarsdotnet’s picture

Title: HTML Mail is incompatible with Mime Mail, because Mime Mail wants it that way. » Problems using HTML Mail with Messaging / Notifications framework
pillarsdotnet’s picture

(looking at the messaging source code)

Okay, what messaging calls "HTML Mail" really means "Use phpmailer instead of drupal_mail".

So I've posted in their issue queue: #1124106: Please rename your "HTML Mail" submodule to avoid confusion with the real HTML Mail module.

Not that I think it will do any good, mind you. They've got 83 open issues at the moment.

pillarsdotnet’s picture

Status: Needs work » Postponed

Marking this postponed as I can't do anything about it until I get some cooperation from the messaging maintainers.

rsbecker’s picture

The odd thing is that if I run the PHP Mailer test it uses the HTML Mail template and produces debug informaton telling me to create a template called htmlmail-phpmailer.tpl.php. In the mailsystem module I seemingly can tell Messaging PHPMailer to use the HTMLMailSystem and I can tell Mail >> PHPMailer to use the HTMLMailSystem. So it is unclear to me why I cannot select PHPMailer in the Messaging framework and get emails processed by HTML Mail?

pillarsdotnet’s picture

Project: HTML Mail » Mail System
Version: 6.x-2.x-dev » 6.x-1.x-dev
Component: Module compatibility » Code
Category: bug » task
Status: Postponed » Active

HTML Mail only gets called by drupal_mail.

Any application that sends mail any other way won't use HTML Mail.

In the 6.x.2.x branch, this happens because Mail System sets the smtp_library variable to point to its own code. If any other module changes this system variable, Mail System (and consequently HTML Mail) will not work.

Hmm... I should probably add a UI to check and/or reset this variable. Probably in the hook_requirements and/or the module settings page.

pillarsdotnet’s picture

Project: Mail System » Messaging
Version: 6.x-1.x-dev » 6.x-4.x-dev
Assigned: pillarsdotnet » Unassigned
Category: task » bug

Tell you what. Since you're having problems with Messaging, I'm gonna redirect to their queue.

pillarsdotnet’s picture

Title: Problems using HTML Mail with Messaging / Notifications framework » Messaging module appears ABANDONED
Status: Active » Closed (won't fix)

Obviously, messaging is unmaintained.

edvanleeuwen’s picture

Status: Closed (won't fix) » Active

pillarsdotnet, Messaging is not abandoned, just not very active.