smtp.module 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file
  4. * Enables Drupal to send e-mail directly to an SMTP server.
  5. *
  6. * This module uses a customized extract of the PHPMailer
  7. * library (originally by Brent R. Matzelle, now maintained
  8. * by Codeworx Tech.) relicensed from LGPL to GPL, included
  9. * as a part of the module.
  10. *
  11. * Overriding mail handling in Drupal to make SMTP the default
  12. * transport layer, requires to change the mail_system variable's
  13. * default value array('default-system' => 'DefaultMailSystem').
  14. * This module uses array('default-system' => 'SmtpMailSystem').
  15. */
  16. /**
  17. * Implements hook_help().
  18. */
  19. function smtp_help($path, $arg) {
  20. switch ($path) {
  21. case 'admin/help#smtp':
  22. return t('Allow for site emails to be sent through an SMTP server of your choice.');
  23. }
  24. }
  25. /**
  26. * Implements hook_menu().
  27. */
  28. function smtp_menu() {
  29. $items['admin/config/system/smtp'] = array(
  30. 'title' => 'SMTP Authentication Support',
  31. 'page callback' => 'drupal_get_form',
  32. 'page arguments' => array('smtp_admin_settings'),
  33. 'access arguments' => array('administer smtp module'),
  34. 'description' => 'Allow for site emails to be sent through an SMTP server of your choice.',
  35. 'file' => 'smtp.admin.inc',
  36. );
  37. return $items;
  38. }
  39. /**
  40. * Implements hook_permission().
  41. */
  42. function smtp_permission() {
  43. return array(
  44. 'administer smtp module' => array(
  45. 'title' => t('Administer SMTP Authentication Support module'),
  46. 'description' => t('Perform administration tasks for SMTP Authentication Support module.'))
  47. );
  48. }
  49. /**
  50. * Implements hook_mail().
  51. */
  52. function smtp_mail($key, &$message, $params) {
  53. if ($key == 'smtp-test') {
  54. $message['subject'] = $params['subject'];
  55. $message['body'] = $params['body'];
  56. }
  57. }