You are here

function hook_mail_safety_pre_send in Mail Safety 7

Same name and namespace in other branches
  1. 8 mail_safety.api.php \hook_mail_safety_pre_send()
  2. 7.2 mail_safety.api.php \hook_mail_safety_pre_send()

Respond to a mail before it is being send.

Parameters

array $message: The message array.

Return value

array Return the message array after any changes.

2 invocations of hook_mail_safety_pre_send()
mail_safety_admin_send_default_form_submit in ./mail_safety.admin.inc
Form submission handler for mail_safety_admin_send_default_form_submit.
mail_safety_admin_send_original_form_submit in ./mail_safety.admin.inc
Form submission handler for mail_safety_admin_send_original_form.

File

./mail_safety.api.php, line 76
Hooks provided by the Mail Safety module.

Code

function hook_mail_safety_pre_send($message) {

  // Loop through the attachments in a message.
  foreach ($message['attachments'] as $key => $attachment) {

    // Return the attachment to the e-mail to send it again.
    $message['params']['attachments'][$key] = array(
      'content' => file_get_contents($attachment->uri),
      'mime' => $attachment->filemime,
      'filename' => $attachment->filename,
    );
  }
  return $message;
}