Commerce Email Documentation

This is the documentation page for the Commerce Email module.

Related modules

Commerce Message
You may wish to consider using Commerce Message, which is part of the Commerce Kickstart distribution and as such is actively maintained an supported. Its dependencies are tried-and-tested and it provides a lot of flexibility, including emailing the order summary and other details, and inline CSS styling via Mimemail / Mailsystem.
Commerce Invoice Receipt
This module provides an additional 'Invoice' display for Commerce orders, as well as a Rules action to email this invoice out to customers. The HTML email can be customised through template files. Unfortunately it relies on Emogrifier for inline CSS, which appears to be rarely maintained.

Dependencies

The 2.x version is still not completely stable, but it should work if you have:

Please make sure you have those modules in their required versions and it should work...
(derived from http://drupal.org/node/1433822#comment-5579468 )

Basic installation and usage guide

  • Download the latest 7.x-2.x version of Commerce Email
  • Download the latest variable-7.x-1.x-dev
  • (So you won't run into #1451680: Notice: Undefined index: module en variable_type_include())

  • Download rules, variable_email, entity, htmlmail, mailsystem, token
  • Enable commerce_email
  • Go to admin/commerce/config/email and configure your emails (it has Token support, so enable Token)
  • Ensure the default email Rules are disabled so you don't send out emails twice (these are commerce_checkout_new_account and commerce_checkout_order_email).

The templating process

2.x uses HtmlMail to handle the theming part, so you'll have to create a template for HtmlMail.
With Commerce Email, it seems like the workflow looks like this :

  1. Commerce Email declares a new token that contains the themed order content information,
  2. Commerce Email uses Variable Email and Rules to send the email
  3. The Mail System module is used to define the mail processor (HtmlMail) to be used for Variable Email.

So at the end : when an order is completed for instance, Rules triggers the "Send a Variable Email" action, which has the order content token, and the email text in a variable (set in admin/commerce/config/email) - Since Variable Email is set to use HtmlMail mail processor, it themes the email with the default theme provided by HtmlMail.

If you want to create a specific template for your email, you'll have to do something like this :
- Create a template email in your theme used for your email (See admin/config/system/htmlmail) with the following template name : htmlmail--variable_email--EMAIL_KEY.tpl.php where EMAIL_KEY is the variable name used (try htmlmail--variable_email--commerce_email_order.tpl.php for the default one).

For more help on the template name suggestion system of HtmlMail, go to admin/config/system/htmlmail and check "debug" checkbox, send an email and you'll see what should be your EMAIL_KEY.
(from http://drupal.org/node/1436428#comment-5653506)

Comments

ShaneOnABike’s picture

At this point if you are using the latest then I think you are okay. The comment made about Variable DEV was posted on February 9th and the latest is as of January 2013 :)

l0calh0rst’s picture

This is a perfect example why drupal commerce is a total flop.
A simple thing such as sending an email which lists the items ordered is so outrageously complex. As a developer/site builder this drives me crazy and makes me cry for the time lost.

griz’s picture

Even the Commerce Invoice Receipt module requires Emogrifier, which hasn't been updated for the last two years and requires two patches to work.

*Edit*

I've finally found the Commerce Messages module, which seems to be the strongest contender so far. It uses Message Notify, which site builders have been using with OG for years now. Inline CSS works via Mimemail / MailSystem.

generalconsensus’s picture

Agreed the state of affairs for Drupal Commerce emails are a pretty sad affair.

griz’s picture

I just hope this doesn't get edited out, as I've explored every dead-end before arriving at Commerce Message and it was a frustrating experience. It appears to be the only viable solution at the moment.

lukasss’s picture

Is it possible to send email to the commerce customers with information about the order, while adding product image in the email?
Product image itself is stored in the node-product-display.
Please help!

For world peace!

lukasss’s picture

... Decided on the basis of the analysis modules: commerce_email commerce_invoice_receipt and came to the conclusion that the most normal way - creation of the token, the contents of which will give an idea of type Line items, you can clone a standard (just in case I did it, because it should be entitled may possible without it). This can be views to theme the usual way.
Then just use this token in commerce_email. All other information about the order, at first glance, there is a token.
Sadly, it would seem, is the standard functionality of the normal shop, but so little information about it ((

For world peace!