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