You are here

function messaging_mail_params in Messaging 5

Helper function for mail methods

This is the only non method agnostic functionality in this module. As there are several plug-ins for mail sending, we add this helper function here so its available for all them

3 calls to messaging_mail_params()
messaging_mail_send_msg in messaging_mail/messaging_mail.module
Send mail message to user account
messaging_mime_mail_send_msg in messaging_mime_mail/messaging_mime_mail.module
Send mime mail message to user account
messaging_phpmailer_send_msg in messaging_phpmailer/messaging_phpmailer.module
Send mail message to user account. Supports bulk sending

File

./messaging.module, line 986

Code

function messaging_mail_params($message, $params) {

  // The message 'from' will depend on message sender if present
  if (empty($params['from'])) {
    if (!empty($message['sender_account']) && !empty($message['sender_account']->mail)) {
      $params['from'] = check_plain($message['sender_account']->name) . ' <' . $message['sender_account']->mail . '>';
    }
    elseif (!empty($message['sender_name']) && ($default_from = variable_get('site_mail', ini_get('sendmail_from')))) {
      $params['from'] = check_plain($message['sender_name']) . ' <' . $default_from . '>';
    }
  }

  // Fill in params with default values if not present
  $params += array(
    'from' => NULL,
    'headers' => array(),
    'mailkey' => 'message-' . $message['type'],
  );
  return $params;
}