You are here

README.txt in Mail System 6

                                 [1]Mail System

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

   The 6.x-1.x branch also provides a Drupal-6 backport of the Drupal-7
   mail system. For more information, see [3]Creating HTML formatted
   emails in Drupal 7.

Administrative UI

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

Used by;

     * [5]HTML Mail
     * [6]Postmark

Developers API

   A module example with a [7]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/dru
          pal_mail_system/7

   MailSystemInterface API documentation:
          http://api.drupal.org/api/drupal/includes--mail.inc/interface/Ma
          ilSystemInterface/7

   Creating HTML formatted mails in Drupal 7
          http://drupal.org/node/900794

References

   1. http://drupal.org/project/mailsystem
   2. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
   3. http://drupal.org/node/900794
   4. http://drupal.org/node/1089888
   5. http://drupal.org/project/htmlmail
   6. http://drupal.org/project/postmark
   7. http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7

File

README.txt
View source
  1. [1]Mail System
  2. Provides an Administrative UI and Developers API for safely updating
  3. the [2]mail_system configuration variable.
  4. The 6.x-1.x branch also provides a Drupal-6 backport of the Drupal-7
  5. mail system. For more information, see [3]Creating HTML formatted
  6. emails in Drupal 7.
  7. Administrative UI
  8. The administrative interface is at admin/config/system/mailsystem. A
  9. [4]screenshot is available.
  10. Used by;
  11. * [5]HTML Mail
  12. * [6]Postmark
  13. Developers API
  14. A module example with a [7]MailSystemInterface implementation called
  15. ExampleMailSystem should add the following in its example.install file:
  16. /**
  17. * Implements hook_enable().
  18. */
  19. function example_enable() {
  20. mailsystem_set(array('example' => 'ExampleMailSystem'));
  21. }
  22. /**
  23. * Implements hook_disable().
  24. */
  25. function example_disable() {
  26. mailsystem_clear(array('example' => 'ExampleMailSystem'));
  27. }
  28. The above settings allow mail sent by example to use ExampleMailSystem.
  29. To make ExampleMailSystem the site-wide default for sending mail:
  30. mailsystem_set(array(mailsystem_default_id() => 'ExampleMailSystem'));
  31. To restore the default mail system:
  32. mailsystem_set(array(mailsystem_default_id() => mailsystem_default_value()));
  33. Or simply:
  34. mailsystem_set(mailsystem_defaults());
  35. If module example relies on dependency foo and its FooMailSystem class,
  36. then the example.install code should like like this:
  37. /**
  38. * Implements hook_enable().
  39. */
  40. function example_enable() {
  41. mailsystem_set(array('example' => 'FooMailSystem'));
  42. }
  43. /**
  44. * Implements hook_disable().
  45. */
  46. function example_disable() {
  47. mailsystem_clear(array('example' => ''));
  48. }
  49. If module example only wants to use FooMailSystem when sending emails
  50. with a key of examail, then the example.install code should look like
  51. this:
  52. /**
  53. * Implements hook_enable().
  54. */
  55. function example_enable() {
  56. mailsystem_set(array('example_examail' => 'FooMailSystem'));
  57. }
  58. /**
  59. * Implements hook_disable().
  60. */
  61. function example_disable() {
  62. mailsystem_clear(array('example_examail' => ''));
  63. }
  64. References
  65. drupal_mail_system() API documentation:
  66. http://api.drupal.org/api/drupal/includes--mail.inc/function/dru
  67. pal_mail_system/7
  68. MailSystemInterface API documentation:
  69. http://api.drupal.org/api/drupal/includes--mail.inc/interface/Ma
  70. ilSystemInterface/7
  71. Creating HTML formatted mails in Drupal 7
  72. http://drupal.org/node/900794
  73. References
  74. 1. http://drupal.org/project/mailsystem
  75. 2. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
  76. 3. http://drupal.org/node/900794
  77. 4. http://drupal.org/node/1089888
  78. 5. http://drupal.org/project/htmlmail
  79. 6. http://drupal.org/project/postmark
  80. 7. http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7