You are here

function phpmailer_mailengine in PHPMailer 8.3

Same name and namespace in other branches
  1. 5.2 phpmailer.module \phpmailer_mailengine()
  2. 5 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().

This is for the Mime Mail module.

File

./phpmailer.module, line 46
Integrates the PHPMailer library for SMTP e-mail delivery.

Code

function phpmailer_mailengine($op, $message = []) {
  if (!class_exists('PHPMailer')) {
    return;
  }
  switch ($op) {
    case 'list':
      return [
        'name' => t('PHPMailer'),
        'description' => t('Mailing engine using the PHPMailer library.'),
      ];
    case 'settings':
      $phpmailer_settings = \Drupal::l(t('PHPMailer settings page'), Url::fromRoute('phpmailer.settings'));
      $form['info']['#markup'] = t('To configure your mail server settings, visit the @url.', [
        '@url' => $phpmailer_settings,
      ]);
      return $form;
    case 'multiple':
    case 'single':
    case 'send':
      module_load_include('inc', 'phpmailer', 'includes/phpmailer.mimemail');

      // Mimemail API does not load mimemail.inc for other mailengines; we rely
      // on mimemail_rfc_headers(), so ensure that it is loaded.
      module_load_include('inc', 'mimemail');
      return mimemail_phpmailer_send($message);
  }
}