Magento 1.9 - style email template

Magento 1.9 - style email template

July 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 1.9 - style email template

Styling Email Templates in Magento: A Comprehensive Guide

As an experienced e-commerce developer, I often encounter challenges when trying to apply custom CSS styles to email templates within the Magento platform. In this post, we’ll delve into a common issue faced by developers like you - applying inline CSS and custom styles to newsletter subscription email templates.

Understanding the Issue

You’ve already taken some initial steps towards styling your email template:

  • You’ve added inline CSS directly to your HTML structure.
  • You’ve included inline CSS files and specified their paths in the admin panel (System > Configuration > Design).

However, you’re facing a few obstacles:

  1. The inline CSS isn’t being applied as expected.
  2. You’re unable to write custom CSS within the style tag generated by {{var non_inline_styles}}.
  3. You’ve tried following the Magento documentation but haven’t found a clear solution.

The Root Cause

The issue lies in the way Magento processes and merges inline styles with your custom CSS files. By default, it doesn’t allow external or non-inlined CSS to be applied directly within the email template. This is due to the complex rendering process of email clients, which often ignore or overwrite external style rules.

A Step-by-Step Solution

To successfully apply custom CSS styles to your Magento email templates, follow these best practices:

  1. Create separate CSS files for inline and non-inline styles

    • Inline CSS: email-inline.css
    • Non-inlined (external) CSS: email-non-inline.css
  2. Specify the CSS file paths in the admin panel

    • Navigate to System > Configuration > Design.
    • Under ‘Email Templates’, set both ‘Inline CSS File’ and ‘Non-Inline CSS File’ to the correct paths of your created files.
  3. Use Magento’s built-in style management features

    • In your template file, include the {{var non_inline_styles}} and {{inlinecss}} variables where needed.
    • Ensure your custom CSS rules are defined correctly in both inline and non-inline CSS files.
  4. Test your email templates thoroughly

    • Send test emails using different email clients (e.g., Gmail, Yahoo, Outlook) to ensure compatibility across all platforms.
    • Monitor the rendered output for any inconsistencies or missing styles.

Advanced Techniques

For more advanced styling requirements:

  1. Use preprocessors and compilers

    • Consider using CSS preprocessors like SASS or LESS in combination with Magento’s inline style management system.
    • Compile your CSS files to ensure they’re compatible with the email merging process.
  2. In-line critical styles directly into HTML elements

    • For essential styles, such as color, font size, and alignment, apply them directly within the HTML element using style attributes.
  3. Optimize image loading

    • Optimize your images for faster loading times in emails.
    • Consider using CSS sprites or data URIs to reduce HTTP requests.

Conclusion

Styling email templates in Magento requires a nuanced understanding of its internal processing and the compatibility constraints imposed by various email clients. By following these best practices and leveraging Magento’s built-in style management features, you’ll be able to create beautifully styled newsletter subscription emails that engage your audience effectively.

Remember to test your work thoroughly across different platforms to ensure a consistent user experience for all your subscribers. If you’re looking for professional assistance or expert guidance on Magento development, don’t hesitate to reach out to our team at https://laravelcompany.com. We’d be delighted to help you navigate the complexities of e-commerce development and deliver exceptional results for your business.

Happy coding!

Magento 1 Themes Admin Configuration

Our network