CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Adding non-generic CiviMail templates
Pages: [1]

Author Topic: Adding non-generic CiviMail templates  (Read 1175 times)

michelle

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.1
  • MySQL version: Ver 14.14 Distrib 5.5.29
  • PHP version: PHP 5.4.6
Adding non-generic CiviMail templates
March 25, 2013, 09:07:10 am
Hello,

I am looking to create one or more email templates for CiviMail. The ones currently available are more generic, so I'm looking into making more "non-generic" templates for more specific scenarios.

1. Suggestions for specific types of emails to make? What are some common scenarios I could target templates for?
2. Do other modules (e.g. Contribution module) make their info available through tokens/variables used in email templates?
3. If so, how much information is available? If not, how can template variables be created?

Thank you in advance. :)

Michelle

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Adding non-generic CiviMail templates
March 25, 2013, 09:23:40 am
Hi Michelle,

Welcome!

Since this is your first message on the forums, I'm not sure what your tech background is - whether you're asking these questions as an end-user or developer of CiviCRM.  I'll try to answer the question as a mix of both.

There are two types of templates - there's templates for user-driven messages and templates for automatic messages (aka "system workflow messages").  The first category is your newsletters, etc. - anything that your users might want to make use of.  I suspect you're interested in the second category.

Question 1:
I think the best thing to do, if you haven't yet, is to check out the list of existing templates.  Go to Administer menu -> Communications -> Message Templates, then click on the "system workflow messages" tab.  You'll see the existing generic templates.

Question 2:
CiviContribute only makes its tokens available from those system workflow messages - not from your user-driven messages.  That said, you can change that via hooks.  Check out this thread for more info: http://forum.civicrm.org/index.php?topic=18952.0

Question 3:
If you're using a system-driven message, there's quite a bit of info - if you're using a user-driven message, much less so.  That said, with hooks you can produce just about any info you want.

As a final bit of administrivia - this is probably the wrong sub-forum for this, since it's about using existing functionality rather than coding new functionality.  I imagine a moderator will move this in short order.

Good luck!
Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

michelle

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.1
  • MySQL version: Ver 14.14 Distrib 5.5.29
  • PHP version: PHP 5.4.6
Re: Adding non-generic CiviMail templates
March 26, 2013, 12:58:52 pm
Hi Jon,

Thanks for the quick response! I am really sorry for posting this in the wrong sub-forum!

To clarify - I am a student doing some development work for Civi for the semester. About types of templates, either type of template (automated or user-driven) works. It sounds like it would be easier to do automatic.

Thanks for all the info! I'll definitely look into hooks. Is there a place I can look at a full list of all the tokens available for a given module besides looking through all the message templates?

Thank you so much!

Michelle

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding non-generic CiviMail templates
March 26, 2013, 05:20:47 pm
Hi Michelle - No worries about 'which forum' - probably fine to discuss here since you are potentially adding some new functionality :-)

One type of 'User-driven' template that I think would be quite useful would deal w/ contribution history and aggregates. So your module would introduce mail-merge tokens for aggregate values (for example:  total contribution amount YTD, MTD, since inception) and possible a token which resolves to a tabular listing of contribution details as well. The module would then inject some sample user-driven templates that use these in thank-you emails.

Not sure if this is beyond the scope of what you were planning, but I think it would be quite well received. If you want to head down this read, a blog post on CiviCRM.org describing your plans with some mockups etc. would be a good start so you can get some feedback from the community.

Currently available tokens for contact data and mailing actions (e.g. unsubscribe link) are listed in the user interface when you go to compose an email. General info on tokens is here: http://book.civicrm.org/user/current/common-workflows/tokens-and-mail-merge/

For the components ('modules') e.g. CiviContribute send a contribution receipt - reviewing the message templates is probably the best approach. You can also get a dump of all available "Smarty" variables for a given message template by adding {debug} somewhere in the message template body. You'll get a dump of variables in the output.

Finally a super important tip for playing w/ message templates ... set this constant in your civicrm.settings.php to 1:
define( 'CIVICRM_MAIL_LOG', '1' );

... which results in all email output being written to text files on disk where you can immediately review it (and no worries about spamming anyone). Assuming you're working w/ a Drupal site, mail messages will generally be in /<drupal_root>/sites/default/files/civicrm/ConfigAndLog/mail directory.

 
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Adding non-generic CiviMail templates

This forum was archived on 2017-11-26.