Monday, November 2, 2009

Magento: How to Customize System Email Templates

This post will walk you through the commonly overlooked steps to customize and apply Magento's system generated email templates for things such as new account verification, order confirmation, shipping update, forgotten password recovery, send to a friend, and many more. Screenshots are included for each step. Magento Commerce excels in making powerful commerce easy to use.

Important Note: You can also edit the default templates in the file structure, but I don't recommend it as they are under the core of Magento and could be overwritten in a future update.

Overview

  1. Create New Email Templates
  2. Assign Your Email Templates to System Events

Create New Email Templates

1. Login to Magento Admin and go to System > Transactional Emails.

2. Click the button at the top right labeled "Add New Template."

3. Choose the default template you want to edit from the dropdown box labeled "Template."

4. Click the button labeled "Load Template."

5. Name your new template in the field labeled "Template Name." I like to name my templates the same name as the default template I am copying—it makes it a lot easier to assign them to events later.

6. Edit the HTML.

7. Click the button at the top right labeled "Save Template."

Assign Your Email Templates to System Events

1. In Magento Admin go to System > Configuration.

2. Browse through the tabs on the left and look for options that allow you to assign an email template.

The full list:

  • Currency Setup (1) > Scheduled Import Settings > Error Email Template
  • Contacts (1) > Email Options > Email Template
  • Catalog (2) > Product Alerts > Stock alert Email Template, Product Alerts Run Settings > Error Email Template
  • Email to a Friend (1) > Email Templates > Select Email Template
  • Newsletter (3) > Subscription Options > Unsubscription Email Template, Subscription Options > Success Email Template, Subscription Options > Confirmation Email Template,
  • Customer Configuration (4) > Create New Account Options > Default Welcome Email, Create New Account Options > Confirmation Link Email, Create New Account Options > Welcome Email, Password Options > Forgot Email Template,
  • Wishlist (1) > Share Options > Email Template
  • Sales Emails (16) > (two per section)
  • Checkout (1) > Payment Failed Emails > Payment Failed Template
  • Admin (1) > Admin User Emails > Forgot Password Email Template
  • System (1) > Log Cleaning > Error Email Template

Example: Go to Customer Configuration > Create New Account Options. You will see three templates you can set: "Default Welcome Email," "Confirmation Link Email," and "Welcome Email."

3. Click the button at the top right labeled "Save Configuration."

Done!

If you get stumped please contact me or leave a comment below. I'm also available for hire!

39 comments:

  1. What a PITA. The coders at Magento could very easily have just added an input form somewhere that asks what email address, phone number and store name I would like on my e-mail messages. Instead I have to go through and manually edit 25+ Templates and then search for an hour while I assign all of these new templates.

    I guess I can't complain because it was free but what a PITA!

    ReplyDelete
  2. What about New Order and New order for guest? I don't see those anywhere but need to change mine. Thank you!

    ReplyDelete
  3. New Order and New Order for guest are both in there... keep looking!

    ReplyDelete
  4. i cannot get rid of the magento demo store logo on the new customer email...preview shows the right logo but when you create a new account the copy is right but keeps the demo store logo...suggestions

    thx r

    ReplyDelete
  5. @Anonymous - Are you using a theme other than the default? That would be the first thing I'd look into.

    ReplyDelete
  6. yes...but the reference logos have been changed both in the theme as well as the default magento folders...the confusing thing is when i run the "preview template" function it displays with the right logo...r

    ReplyDelete
  7. @Anonymous - Here's my ghetto-fix: Overwrite the demo store logos in every place they exist with your logo. Then no matter where it loads from it will still show your logo!

    ReplyDelete
  8. my thoughts exactly...i've done this already :( no luck...even refreshed the cache to see if there was a reference to the xml files...

    ReplyDelete
  9. @Anonymous - Forward me the email in question...

    ReplyDelete
  10. the solution i came up with was to create a new logo file and reference that instead..not an explanation of what was going on though...thx for your input r

    ReplyDelete
  11. Travis, I tried to customize my sales email. And now customers can't checkout using the registration option. They get the error message below. Do you know what this is?

    Undefined index: url in /home/jengalan/public_html/app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 152

    ReplyDelete
  12. @Anonymous - Email me the entire contents of the email you customized.

    ReplyDelete
  13. Hi Travis,
    ok...thank you for gettin back to me. :)
    -Jennifer

    ReplyDelete
  14. Hi Travis! Great post. Do you know how can I add new system events? I created some new status and I wanna send an email based on a template that a created only if an specific status is achieved. Thank you.

    ReplyDelete
  15. I can't find the answer how to assign a new template to new order.

    Thanks

    ReplyDelete
  16. do u know how to add an custom attribute value in the order confirmation email

    ReplyDelete
  17. Thanx a lot !!! it saves my time a lot !!!

    ReplyDelete
  18. Hello Travis, this is great stuff. Any idea if any of these tools can be used to generate an automatic email to go out requesting customers to revisit their ordered item on the website to leave feedback reviews after the receive it? Thanks

    ReplyDelete
  19. I have a new order template that works fine. I needed to change the toll free number. It is easy thru transactional email section to go in and change the number. (When i do it and click save template there is no green message, your xxxx saved successfully) When i preview the template it looks fine, but the actual order messages going to clients dont reflect the change. Any ideas?

    ReplyDelete
  20. Hi there. Great Post. My forgot password email is not working correctly. It is blank where the password is supposed to be when the user receives the email. I checked my code. It seems right but there is another issue with this template as well. It says click here to got to your account and when i click on that link I am taken to the backend magento admin login page. The other email templates seem to work fine for that link adn the code is the same. I just went live with the site yesterday. Any help would be so great. Thank you.

    ReplyDelete
  21. Thanks, I almost changing the default templates... phew... :)

    ReplyDelete
  22. @Anonymous (feedback reviews) - You would need to build a custom extension and add something to Magento's cron job that get's fired on a regular basis. The extension could look at orders between a certain timeframe and email the buyer with links to the product review pages.

    ReplyDelete
  23. @Don Fuller - Did you follow my section above—Assign Your Email Templates to System Events? It sounds like you don't have your custom template assigned. You could also try refreshing caches.

    ReplyDelete
  24. @michelle - I would create a new custom email and refresh it from the system template. Edit that, then be sure to assign it to the correct event.

    ReplyDelete
  25. I'm trying to customize the order conformation email to show the customers VAT Number - I just can't figure this one out.Do you know how to go about it?

    ReplyDelete
  26. Hey travis good posting. i am having an issue with the emails i edited the template to display my company name but as soon as i begin to do this the template/text changes entirely. Eg as i input my company name for new accounts, the sample text all seems fine but when it's used the customer only receives that last line being contact "comp. name" and phone number all the text above is missing. any ideas as to why. I loaded and edited 3 templates and it occurred on all 3, :(

    ReplyDelete
  27. Nice post dude.
    If you want to customize new order email template in magento, see this http://www.webspeaks.in/2011/06/customize-new-order-email-template-in.html

    ReplyDelete
  28. because magento is very good piece of software, everything is coordinated and managed very well :)

    ReplyDelete
  29. what variable can i use to show the customers email address in an email template.
    For example, for a new order template...everything works fine, i get an email with shipping, billing, order details etc...but it doesnt show the customers email address.
    Any help would be appreciated thanks

    ReplyDelete
  30. Try order.getCustomerEmail()

    ReplyDelete
  31. Great posting and a lot of help for a complete newby - thanks!

    ReplyDelete
  32. here is an detailed blog on email templates
    http://www.excellencemagentoblog.com/magento-advanced-transactional-email-templates

    ReplyDelete
  33. Can anyone tell me how to include the short description in the order conformation?

    ReplyDelete
  34. how about having images in the content of the template.

    ReplyDelete
  35. Does anyone know how to create a new template? For example a Request a Review Follow Up Email. Is it possible to modify any of the default templates creating a follow-up email requesting and directing a customer to write a review of thier recent purchase order?

    ReplyDelete
  36. Thank you SO much! This is exactly what I needed. And I agree with some of the others, it's a real PITA to have to go through all of these templates!

    I thought osCommerce was obnoxious, but Magento makes that seem like child's play.

    Thanks again for this tutorial. Are you available to do Magento customizations (e.g., shipping rules, multi-level navigation, sort by Brand, etc.)?

    ReplyDelete