In this tutorial, you'll learn how to use Mime Mail to configure Drupal to send HTML emails. We'll also look at how to send them using Rules.

Let's begin by downloading a few modules. Go ahead and download Rules, Entity API, Mime Mail and Mail System. If you prefer Drush, run the following command:

drush dl rules entity mimemail mailsystem

Once everything has been downloaded, enable Mail System, Mime Mail, Rules and Rules UI.

Step 1 - Configure Mail System

Go to Configuration, "Mail System" and make sure that MimeMailSystem has been selected in the "Site-wide default MailSystemInterface class" and "Mime Mail module class" drop-down list.

Step 2 - Configure Mime Mail

Now, head over to Configuration and click on "Mime Mail". From this page you can change a few of the module's configuration options. The one we're interested in, for now, is the "E-mail format".

Change it from "Plain text" to "Filter HTML". This means that when emails are sent they'll be filtered by the "Filter HTML" text format.

At this point, you should be able to send HTML emails. If certain tags are being filtered out, make sure that the text format selected in "E-mail format" allows the tags.

How to Send HTML Emails using Rules

Mime Mail integrates beautifully with Rules. The module implements two custom actions: "Send HTML e-mail" and "Send HTML mail to all users of a role". As you may have guessed, both actions allow you to send emails as HTML.

I won't go through the process of creating a basic rule. I'll assume you've already created one. So go and edit a rule that will send an email. Click on "Add action" and select "Send HTML e-mail" or "Send HTML mail to all users of a role" from the drop-down list.

As you can see, sending HTML emails from Drupal is not that hard. However, if you're emails are still being sent as plain text and you have a lot of modules installed start reviewing your existing setup. Occasionally, a module might change some mail setting that prevents an email from being sent as HTML. Drupal 7.39 Hosting is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.