You are here

function mimemail_mailengine in Mime Mail 5

Same name and namespace in other branches
  1. 6 mimemail.module \mimemail_mailengine()
  2. 7 mimemail.module \mimemail_mailengine()

The default mailengine.

Parameters

$op: The operation to perform on the message.

$message: The message to be sent.

Return value

Returns TRUE if the operation was successful or FALSE if it was not.

File

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

Code

function mimemail_mailengine($op, $message = array()) {

  //default values
  $message = array_merge(array(
    'address' => '',
    'subject' => '',
    'body' => '',
    'sender' => '',
    'headers' => '',
  ), $message);
  switch ($op) {
    case 'name':
      return t('Mime Mail');
    case 'description':
      return t("Default mailing engine using drupal_mail().");
    case 'settings':

      //not implemented
      return FALSE;
    case 'multiple':
    case 'single':
    case 'send':
      if (!is_array($message['address'])) {
        $message['address'] = array(
          $message['address'],
        );
      }
      $status = TRUE;
      foreach ($message['address'] as $a) {
        $status = mail($a, $message['subject'], $message['body'], mimemail_rfc_headers($message['headers'])) && $status;
      }
      return $status;
  }
  return FALSE;
}