messaging_mail.module in Messaging 5
Simple mail using Drupal API. Messaging method plug-in
This is also the reference implementation of sending method plug-ins
File
messaging_mail/messaging_mail.moduleView source
<?php
/**
* @file
* Simple mail using Drupal API. Messaging method plug-in
*
* This is also the reference implementation of sending method plug-ins
*/
/**
* Implementation of hook_messaging()
*
* Currently the only operation supported is 'send methods' that will retrieve and array
* with information fo the sending methods provided by this module.
*
* @param $op
* Type of information to retrieve.
* @return mixed
* Depending on $op
*/
function messaging_mail_messaging($op) {
switch ($op) {
case 'send methods':
$info['mail'] = array(
'name' => t('Mail'),
// Name for display
'group' => 'mail',
// Class of sending method
'destination' => 'mail',
// Account property to use as destination
'send' => 'messaging_mail_send_msg',
// Sending callback
'type' => MESSAGING_TYPE_PUSH,
// Method type: push || pull
'glue' => "\n",
// Glue for message body lines
'footer' => "\n--",
// Separator for message footer
'description' => t('Send e-mails using the default Drupal mail library.'),
);
return $info;
}
}
/**
* Send mail message to user account
*
* This is a callback function that will be invoked from messaging delivery methods
*
* @see messaging_message_send()
* @see messaging_mail_params()
* @see drupal_mail()
*
* @param $destination
* Single email address
* @param $message
* Message array
* @param $params
* Optional parameters for this method type
*/
function messaging_mail_send_msg($destination, $message, $params = array()) {
$params = messaging_mail_params($message, $params);
return drupal_mail($params['mailkey'], $destination, $message['subject'], $message['body'], $params['from'], $params['headers']);
}
Functions
Name | Description |
---|---|
messaging_mail_messaging | Implementation of hook_messaging() |
messaging_mail_send_msg | Send mail message to user account |