You are here

function phpmailer_mailengine in PHPMailer 5

Same name and namespace in other branches
  1. 8.3 phpmailer.module \phpmailer_mailengine()
  2. 5.2 phpmailer.module \phpmailer_mailengine()
  3. 6.3 phpmailer.module \phpmailer_mailengine()
  4. 6 phpmailer.module \phpmailer_mailengine()
  5. 6.2 phpmailer.module \phpmailer_mailengine()
  6. 7.4 phpmailer.module \phpmailer_mailengine()
  7. 7.3 phpmailer.module \phpmailer_mailengine()

Implementation of hook_mailengine().

File

./phpmailer.module, line 60
This module integrates PHPMailer with Drupal, both as native drupal_mail() wrapper, and as part of the Mime Mail module.

Code

function phpmailer_mailengine($op, $message = array()) {
  switch ($op) {
    case 'name':
      return t('PHPMailer');
    case 'description':
      return t('Mailing engine using PHPMailer.');
    case 'settings':
      require_once drupal_get_path('module', 'phpmailer') . '/phpmailer.admin.inc';
      return _phpmailer_settings_form();
    case 'multiple':
    case 'single':
    case 'send':
      include_once drupal_get_path('module', 'phpmailer') . '/includes/mimemail.inc';
      $defaults = array(
        'address' => '',
        'subject' => '',
        'body' => '',
        'sender' => '',
        'headers' => array(),
      );
      $message = array_merge($defaults, $message);
      settype($message['address'], 'array');
      $status = mimemail_phpmailer_send($message['address'], $message['subject'], $message['body'], $message['sender'], $message['headers']);
      return $status;
  }
  return FALSE;
}