Last updated February 16, 2013. Created by pillarsdotnet on June 26, 2011.
Edited by wundo, develkar, Sheldon Rampton, Atul_Rai. Log in to edit this page.
The Mail System module supports using one mail system to format your messages, and another to mail them. This tutorial explains how you may combine the rich formatting options of HTML Mail with the flexible sending options of SMTP Authentication Support.
Install Modules
First, you need to install at least the following modules:
The following modules are optional but recommended for maximum theming power:
Configure Mail System
After installing your modules, visit the Mail System Settings page at admin/config/system/mailsystem and click on the New Class fieldset to show its options. Then select HTMLMailSystem for the format method, and SmtpMailSystem for the mail method, and click on the Save Settings button at the bottom.
Screenshot 2: Adding a New Mail Class
Select the newly-created HTMLMailSystem__SmtpMailSystem class for both the site-wide default mailer and the HTML Mail module mailer.
Screenshot 3: Selecting Site-wide and Per-module Mailers
Create a Mail Filter
If you installed the optional filter modules, you should probably create a text format for your email messages. Visit admin/config/content/formats/add to add a new text format. Since this filter will only be used by the mail system, you don't need to check any of the Roles. Select the filters to be applied to your email messages. If you use the Pathalogic filter, be sure and add a single slash / character to its Also considered local box.
Screenshot 4: Creating a Mail Filter Format
Configure HTML Mail
Visit the HTML Mail Settings page at admin/config/system/htmlmail and select the appropriate options.
-
- Template file
- The only configurable option is the Debug checkbox, but if you plan to write your own template files, click on the Instructions link for some helpful information.
-
- Email theme
- If you installed the Echo module, or if you plan to write your own template files, you should create a subtheme and select it here.
-
- Post-filtering
- If you created a text format for emails, select it here.
Screenshot 5: Configuring HTML Mail
Configure SMTP Authentication Support
Visit the SMTP Authentication Support Settings page at admin/config/system/smtp and select the appropriate options.
Send a Test Message
To test mail sending, visit the HTML Mail Send Test page at admin/config/system/htmlmail/test and click the Send test message button at the bottom.
Screenshot 6: Sending a Test Message
Receive the Test Message
Check your mail program to see whether the test message was properly themed, styled, and delivered.
Screenshot 7: Receiving a Test Message
For further assistance, visit:
Alternative Approach: Mail System + SMTP + Mime Mail
It is also possible to generate HTML-formatted email with MIME attachments using a different combination of modules. Instead of using the HTML Module, you can use Allie Micka's Mime Mail module. You can use the Mail System module to glue Mime Mail together with SMTP the same way that you can glue HTML Mail together with SMTP. For this approach, you will need the following modules:
After installing your modules, visit the Mail System Settings page at admin/config/system/mailsystem and click on the New Class fieldset to show its options. Then select MimeMailSystem for the format method, and SmtpMailSystem for the mail method, and click on the Save Settings button at the bottom.
Select the newly-created MimeLMailSystem__SmtpMailSystem class for both the site-wide default mailer and the Mime Mail module mailer.
The Mime Mail module has its own system for supporting HTML-formatted emails as well as MIME attachments. This approach may be easier to implement if you are already using the Mime Mailer module on your website, and it is a little easier to configure in general. However, currently the Mime Mail module does not properly send file attachments via the SMTP mail system. The HTML Mail approach described above can offer its own advantages. The HTML Mail module can also handle MIME attachments with its related Mail MIME module. Please note that the Mail MIME module is different from Allie Micka's Mime Mail module, so be careful not to confuse them.
Comments
This saved my bacon. Thanks
I am using combination of Mail System, MIME Mail, and SMTP Authentication Support - and sending emails via mailjet. It was working great for system transactional emails & simplenews newsletters. But a webform based contact form on the site refused to send via SMTP.
Your doco above gave me the clue in Screenshot 3: Selecting Site-wide and Per-module Mailers and Once I specifically ADDED webform module as a NEW SETTING to the Mail System settings, and set it to be the same as site default - it all started working for me. Apparently webform does not use the site default? anyway - all great , and thanks for the excellent doco.
Hi there, excellent
Hi there, excellent post!
When I try to create a new class with HTML mail as formatter and SMTP as sender, mail system displays a " settings saved" message but the new class is not created.
I have been googling for this issue but apparently it is not very common.
Do you have any idea why this can be so? Is there any way to create a new class manually?
Thanks in advance.
Cannot find SmtpMailSystem for the mail method
When I am configuring the Mail System, adding New Class, I cannot find SmtpMailSystem for the mail method.
Also cannot find SmtpMailSystem
I'm having the same problem: smtpmailsystem isn't in the select list.
Just a thought. I'm using D6 - does this procedure only work in D7?
I assume you have installed
I assume you have installed the SMTP support module as instructed?
I'm a pretty new starter (Using Drupal 7 and that module), and found the smtpmailsystem as described.
smtpmailsystem
Yeah, the class interface was introduced in D7.
Mailsystem and HTML Mail have backported the interface to D6, but other module authors have not.
Good. — Fast. — Cheap.
(Pick any two.)
Sub
Sub