Downloads

Download tar.gz 13.3 KB
MD5: a6090c3ad47b5d9cd1705080b9616517
SHA-1: f9e7a5eb04358c6ef01c34c7ed27d84ae9492e34
SHA-256: 4d6429220c6b65175e9445f13fb291dcb95decdf117a112625b573b7e5fd21f7
Download zip 16.52 KB
MD5: 97c1261e5ce571a023b857b01c8f2863
SHA-1: e751f246b9650e2710d58f214dff963d5e6f82ce
SHA-256: 1dd1a26aea973a240e3eb884690ada49b49ccd4e181f6133c3015bf26c0e2d54

Release notes

Improvements:
Better admin UI
Mail System

Provides an Administrative UI and Developers API for safely updating the mail_system configuration variable.

Administrative UI

The administrative interface is at admin/config/system/mailsystem. A screenshot is available.

Used by;

Developers API

A module example with a MailSystemInterface implementation called ExampleMailSystem should add the following in its example.install file:

/**
 * Implements hook_enable().
 */
function example_enable() {
  mailsystem_set(array('example' => 'ExampleMailSystem'));
}
/**
 * Implements hook_disable().
 */
function example_disable() {
  mailsystem_clear(array('example' => 'ExampleMailSystem'));
}

The above settings allow mail sent by example to use ExampleMailSystem. To make ExampleMailSystem the site-wide default for sending mail:

mailsystem_set(array(mailsystem_default_id() => 'ExampleMailSystem'));

To restore the default mail system:

mailsystem_set(array(mailsystem_default_id() => mailsystem_default_value()));

Or simply:

mailsystem_set(mailsystem_defaults());

If module example relies on dependency foo and its FooMailSystem class, then the example.install code should like like this:

/**
 * Implements hook_enable().
 */
function example_enable() {
  mailsystem_set(array('example' => 'FooMailSystem'));
}
/**
 * Implements hook_disable().
 */
function example_disable() {
  mailsystem_clear(array('example' => ''));
}

If module example only wants to use FooMailSystem when sending emails with a key of examail, then the example.install code should look like this:

/**
 * Implements hook_enable().
 */
function example_enable() {
  mailsystem_set(array('example_examail' => 'FooMailSystem'));
}
/**
 * Implements hook_disable().
 */
function example_disable() {
  mailsystem_clear(array('example_examail' => ''));
}

References

drupal_mail_system() API documentation:

http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail...

MailSystemInterface API documentation:

http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystem...

Creating HTML formatted mails in Drupal 7

http://drupal.org/node/900794

Created by: pillarsdotnet
Created on: 14 Apr 2011 at 21:50 UTC
Last updated: 14 Apr 2011 at 21:51 UTC
Unsupported

Other releases