Install

Works with Drupal: 7.x

Using Composer to manage Drupal site dependencies

Downloads

Download tar.gz 8.26 KB
MD5: 8ad405dd7622113c745c037dffe3d700
SHA-1: 5f33a71e5d2fa87bf0dd17fce2b0e30a6c1594e2
SHA-256: dad7fe80507437641714eb664c8fdfc2266d4e846bb25c6fa56e1b50a2fc590f
Download zip 9.13 KB
MD5: 8d64f2fa48f5737a8dd81cc7abceb827
SHA-1: ef4e094ca05c97453d15b9ec7f2ed1789c2dc8fa
SHA-256: 63e77d58513a79dfebc885ca11b07221f98ea755f41828ddbdbb99bffd1d1944

Release notes

Provides administrative UI and API for safely setting the mail_system variable.

A module "foo" with a MailSystemInterface implementation called "FooMailSystem" should add the following in its foo.install file:


/**
 * Implements hook_enable().
 */
function foo_enable() {
  mailsystem_set(array('foo' => 'FooMailSystem'));
}

/**
 * Implements hook_disable().
 */
function foo_disable() {
  mailsystem_clear(array('foo' => 'FooMailSystem'));
}

The above settings allow mail sent by "foo" to use "FooMailSystem". To make "FooMailSystem" the site-wide default for sending mail,

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

To restore the default mail system,

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

Or simply:

  mailsystem_set(mailsystem_defaults());

If module "foo" relies on dependency "bar" and its "BarMailSystem" class, then its code should like like this:


/**
 * Implements hook_enable().
 */
function foo_enable() {
  mailsystem_set(array('foo' => 'BarMailSystem'));
}

/**
 * Implements hook_disable().
 */
function foo_disable() {
  mailsystem_clear(array('foo' => ''));
}

If module "foo" only wants to use "BarMailSystem" when sending emails with a key of "foomail", then its code should look like this:


/**
 * Implements hook_enable().
 */
function foo_enable() {
  mailsystem_set(array('foo_foomail' => 'BarMailSystem'));
}

/**
 * Implements hook_disable().
 */
function foo_disable() {
  mailsystem_clear(array('foo_foomail' => ''));
}

Created by: pillarsdotnet
Created on: 11 Mar 2011 at 23:10 UTC
Last updated: 11 Mar 2011 at 23:11 UTC
New features
Unsupported

Other releases