You are here

messaging_mime_mail.module in Messaging 6

Mime mail using Drupal API. Messaging method plug-in

File

messaging_mime_mail/messaging_mime_mail.module
View source
<?php

/**
 * @file
 * Mime mail using Drupal API. Messaging method plug-in
 */

// Include messaging mail library
require_once drupal_get_path('module', 'messaging') . '/messaging.mail.inc';

/**
 * Implementation of hook_messaging
 */
function messaging_mime_mail_messaging($op = 'info') {
  switch ($op) {
    case 'send methods':
      $info['mimemail'] = array(
        'title' => 'Mime Mail',
        'name' => t('Mime Mail'),
        // Name for display
        'group' => 'mail',
        // Class of send method
        'destination' => 'mail',
        // Account property to use as destination
        'type' => MESSAGING_TYPE_SEND,
        // Method type: push || pull
        'glue' => "<br>",
        // don't use <br/> nor <br /> for maximum HTML email client compatibility
        'footer' => "<br><br>--",
        // Separator for message footer
        'send callback' => 'messaging_mime_mail_send_msg',
      );
      return $info;
  }
}

/**
 * Send mime mail message to user account
 * 
 * @param $destination
 *   Destination email address
 * @param $message
 *   Message array
 */
function messaging_mime_mail_send_msg($destination, $message, $params = array()) {

  // Get parameters without invoking hook_mail_alter()
  $mail = messaging_mail_prepare($destination, $message, $params, FALSE);

  // mimemail($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '')
  return mimemail($mail['from'], $mail['to'], $mail['subject'], $mail['body'], NULL, $mail['headers'], NULL, array(), '');
}

/**
 * Implementation of hook_disable()
 */
function messaging_mime_mail_disable() {
  messaging_method_disable('mimemail');
}

Functions

Namesort descending Description
messaging_mime_mail_disable Implementation of hook_disable()
messaging_mime_mail_messaging Implementation of hook_messaging
messaging_mime_mail_send_msg Send mime mail message to user account