You are here

function mimemail in Mime Mail 5

Same name and namespace in other branches
  1. 6 mimemail.module \mimemail()
1 call to mimemail()
mimemail.module in ./mimemail.module
Component module for sending Mime-encoded emails.
3 string references to 'mimemail'
mimemail.inc in ./mimemail.inc
mimemail_menu in ./mimemail.module
Implementation of hook_menu()
mimemail_settings in ./mimemail.module
Administration settings.

File

./mimemail.module, line 243
Component module for sending Mime-encoded emails.

Code

function mimemail($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '') {
  $engine = variable_get('mimemail_engine', 'mimemail') . '_mailengine';
  if (!function_exists($engine)) {
    return FALSE;
  }

  // Allow modules implementing hook_mail_alter() to function when all
  // mail is routed through mimemail.
  //  - doesn't support passing all the variables used here (e.g. attachements)
  //  - should also provide a hook_mimemail_alter for full mimemail support
  foreach (module_implements('mail_alter') as $module) {
    $function = $module . '_mail_alter';
    $function($mailkey, $recipient, $subject, $body, $sender, $headers);
  }
  $engine_prepare = variable_get('mimemail_engine', 'mimemail') . '_prepare';
  if (function_exists($engine_prepare)) {
    $message = $engine_prepare($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
  }
  else {
    $message = mimemail_prepare($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
  }
  return $engine('send', $message);
  return FALSE;
}