MENU_NORMAL_ITEM, 'title' => 'E-mail delivery', 'description' => 'Configure settings for e-mail delivery.', 'page callback' => 'drupal_get_form', 'page arguments' => array('swiftmailer_admin_default_form'), 'file' => 'includes/pages/swiftmailer_admin_default.inc', 'access arguments' => array(SWIFTMAILER_ADMINISTER), ); $items['admin/config/people/swiftmailer/default'] = array( 'type' => MENU_DEFAULT_LOCAL_TASK, 'title' => 'Library', 'description' => 'Configure where the Swift Mailer Library is located.', 'weight' => -10, ); $items['admin/config/people/swiftmailer/transport'] = array( 'type' => MENU_LOCAL_TASK, 'title' => 'Transport', 'description' => 'Configure how Swift Mailer will send e-mails.', 'page callback' => 'drupal_get_form', 'page arguments' => array('swiftmailer_admin_transport_form'), 'file' => 'includes/pages/swiftmailer_admin_transport.inc', 'access arguments' => array(SWIFTMAILER_ADMINISTER), ); $items['admin/config/people/swiftmailer/messages'] = array( 'type' => MENU_LOCAL_TASK, 'title' => 'Messages', 'description' => 'Configure how Swift Mailer will compose messages.', 'page callback' => 'drupal_get_form', 'page arguments' => array('swiftmailer_admin_messages_form'), 'file' => 'includes/pages/swiftmailer_admin_messages.inc', 'access arguments' => array(SWIFTMAILER_ADMINISTER), 'weight' => 2, ); $items['admin/config/people/swiftmailer/test'] = array( 'type' => MENU_LOCAL_TASK, 'title' => 'Test', 'description' => 'Send a test e-mail to verify that the configuration works.', 'page callback' => 'drupal_get_form', 'page arguments' => array('swiftmailer_admin_test_form'), 'file' => 'includes/pages/swiftmailer_admin_test.inc', 'access arguments' => array(SWIFTMAILER_ADMINISTER), 'weight' => 2, ); return $items; } /** * Implements hook_mail(). */ function swiftmailer_mail($key, &$message) { global $user; //$message['params']['format'] = SWIFTMAILER_FORMAT_HTML; $text[] = '

' . t('Dear !user,', array('!user' => $user->name)) . '

'; $text[] = '

' . t('This e-mail has been sent from !site by the Swift Mailer module. The module has been successfully configured.', array('!site' => variable_get('site_name', 'a Drupal site'))) . '

'; $text[] = t('Kind regards') . '

'; $text[] = t('The Swift Mailer module'); $message['subject'] = t('Swift Mailer has been successfully configured!'); $message['body'] = $text; } /** * Implements hook_theme(). */ function swiftmailer_theme($existing, $type, $theme, $path) { $config = array( 'swiftmailer' => array( 'template' => 'swiftmailer', 'variables' => array( 'message' => '', ), 'path' => drupal_get_path('module', 'swiftmailer') . '/includes/theme', 'mail theme' => TRUE, ), ); return $config; } /** * Implements hook_permission() */ function swiftmailer_permission() { return array( SWIFTMAILER_ADMINISTER => array( 'title' => t('Administer Swift Mailer'), ), ); }