Email Templates

10 posts by 4 authors in: Forums > CMS Builder
Last Post: February 8, 2016   (RSS)

By Twocans - February 1, 2016

Hello,
I see in the CMS I have 2 areas that stipulate Email Templates, aka I purchased the "Website Comments" plugin in the past and the Membership plugin.

Under My Admin area I have a link that states "Email Templates", and when I see the Website comments area I see a child menu that states Email Templates

My question is.... where can I find a bit of a step by step tutorial on using or creating an email template.

http://www.interactivetools.com/forum/forum-posts.php?2.52-email-tutorial-78703

I see the above link regarding the Email Templates but am wondering have you advanced any further on this. 

Can the tools provided so far be used to create different types of forms and then the code generator pop out the code. 

i am not trying to stress you guys out, just I have been giving this a good rattle all day and wow, no matter what I cannot get things to think as I feel maybe they should, Thus rather then digging deeper tomorrow I prefer to know am I trying to do something that is possible using your tools alone or do they not actually do as one is made to believe, if so how can I understand how to do it correct.

Regards

Kenny


By ross - February 1, 2016

Hi Kenny

When you are making your own email templates, I recommend always using the section under Admin.  The other two email template sections you mentioned are specific to the plugins they come with and don't usually get changed.

Having said that, could you give me more details on how you want to use the email template?

Do you have a submit form on your site and an email is generated each time that form is submitted? Or maybe you have a script that needs to send emails.

Let me know.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By ross - February 4, 2016

Hi Kenny

I can go over the basics with you here.

The email templates are fully functional so you can use them right away.  

For my example, I'll assume that you have an email form on your site that lets visitors email you questions. The form will have the following fields:

Name
Email
Comment

The first thing we'll look at is the code you need on your page:

$emailHeaders = emailTemplate_loadFromDB(array(
    'template_id'  => 'COMMENT-TO-ADMIN',
    'placeholders' => array(
      'user.name'     => $_REQUEST['username'],
      'user.email'    => $_REQUEST['email'],
      'user.comment'  => $_REQUEST['comment'],

  )));
$mailErrors   = sendMessage($emailHeaders);

You can put this after any error checking you want to do when the form is submitted (I won't be going over that in this overview).

Next, you need to log into CMS Builder and create a new email template. Make sure you do this in the Email Templates section under Admin.

Here's how I would fill out the fields

Template ID =>  COMMENT-TO-ADMIN
Description  => This email gets sent to site admin each time the comment form is submitted
From              => #user.email#
To                   => #settings.adminEmail#

Subject                  => New Comment From #user.name#
Message HTML   => #user.comment#

And then leave everything else as it is.

Things to note here

1. You can see that anything I set as a "placeholder" in PHP is available in the email template with the hash marks. Ex: 'user.name' in PHP becomes #user.name# in the template.

2. Placeholder names are completely customization. Ex: 'user.name' could just be 'name'.  Sometimes you'll want to have a lot of placeholders and naming them specifically helps organize things.

3. There are several placeholders available to every email template. Ex: #settings.adminEmail#. You'll see a full list of those in the email template under the Instructions heading.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Toledoh - February 4, 2016

This is great Ross - thanks

Cheers,

Tim (toledoh.com.au)

By Twocans - February 5, 2016

Ross thank you,

Sorry to sound very very vague but I am still at a loss as to what the email templates actually do.

I have a blank page, containing a form.

+===================================+
My Form Start
+===================================+

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>

<form>
<table width="400" border="0">
<tbody>
<tr>
<td><label for="username">name:</label>
<input type="text" name="username" id="username"></td>
</tr>
<tr>
<td><label for="email">email:</label>
<input type="text" name="email" id="email"></td>
</tr>
<tr>
<td><label for="comment">comment:</label>
<input type="text" name="comment" id="comment"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</form>

</body>
</html>

+===================================+
My Form End
+===================================+

I have done as you have mentioned.

+===================================+
As you have mentioned Start
+===================================+

Next, you need to log into CMS Builder and create a new email template. Make sure you do this in the Email Templates section under Admin.

Here's how I would fill out the fields

Template ID =>  COMMENT-TO-ADMIN
Description  => This email gets sent to site admin each time the comment form is submitted
From              => #user.email#
To                   => #settings.adminEmail#

Subject                  => New Comment From #user.name#
Message HTML   => #user.comment#

And then leave everything else as it is.

+===================================+
As you have mentioned End
+===================================+

In the Email Templates page of my CMS I check the checkbox next to what I have created COMMENT-TO-ADMIN


I select the Advanced Commands Listmenu and select.

Code Generator, only to be taken to a page with Create a Viewer, and Other Generators. I soon realise I am not supposed to be at this page.


I return to the Email Templates page of my CMS

I select the Advanced Commands Listmenu and select.

Developers: Export Templates As PHP,

but Sorry Ross I do not know what the templates is suppose to do.

Am I supposed to get output of the complete Code that then gives me my email form on the page, this is what I was assuming an email template tool was. 

I have looked around for tutorials on this but no joy, if their was some documentation to state that, the email template was not a template creator as such they I would understand.

i know with the cms, I can create whatever I want and it produces the code and was under the impression thats what email templates area was for.

Regards and thanks for all input


Kenny

By Toledoh - February 5, 2016

Hey Kenny.

I used to, for instance, have contact forms on my website that when filled in would send an email to XXX with the form content, using a bunch of php code that really just delivered the bare essentials in an ugly email.  I now use the CMSB email templates and code like Ross provided.  This allows me to;

  1. include the emails sent in the Outgoing Mail Log, and keep track of what emails have been sent - handy when client say they are not receiving any emails.
  2. gain more formatting control over the email, especially important in emails going to end users as I can include logos, formatting etc.
  3. use placeholders when required - like data from other sections of the site.

You may also be interested in investigating;

  • CSS inliners (like: http://foundation.zurb.com/emails/inliner.html). These will take CSS from embedded stylesheets and turn it into inline css so email clients like Gmail will not strip out the styles.
  • 3rd party SMTP servers - like provided by http://mandrill.com/.  Mandril sends 12000 emails a month for free, and give you a great interface that allows you deeper stats on email delivery etc, plus has easy processes in place that help with setting up SPF and DKIM settings that will help the deliverability of your emails.

Hope that helps.

Cheers,

Tim (toledoh.com.au)

By Twocans - February 5, 2016

Thank you Tim,

OK I see, the "email template" area and code generate is not for making email forms in itself but for other things. I know how to use css no problem, I can use the cms, but what had confused me was using the cms it gives you code to literally stick on ones page and it calls all the info from the database, I had thought that is what the email templates was for. I had thought set a few settings and it would generate the form code without much fuss. 

I am not complaining etc, but was just confused as to was there a simple process for creating email forms using the email templates code generator, and it appears not.

Have a lovely weekend

Cheers

kenny

Hi Kenny,

It looks like Twocans and Toledoh have got you on the right track, let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Twocans - February 8, 2016

Hi Greg

Thanks i am towcans it is my username.

Anyway its ok i see the email templates do not really have an actual function as such. I had thought that the code generator and email templates could be used like the cms aka actually create an input and the code generator would create the output. 

Regards

Kenny