You are here

function hook_sparkpost_mail_alter in Sparkpost email 8.2

Same name and namespace in other branches
  1. 7.2 sparkpost.api.php \hook_sparkpost_mail_alter()
  2. 7 sparkpost.api.php \hook_sparkpost_mail_alter()

Alter the sparkpost message before it gets sent to sparkpost.

Parameters

array $sparkpost_message: The sparkpost message, about to be sent to the webservice.

array $message: The Drupal message. That is, the array that is passed to the mail system.

1 invocation of hook_sparkpost_mail_alter()
SparkpostMail::mail in src/Plugin/Mail/SparkpostMail.php
Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail().

File

./sparkpost.api.php, line 16
Hooks provided by the Sparkpost module.

Code

function hook_sparkpost_mail_alter(array &$sparkpost_message, array &$message) {

  // If the message is a specific type of mail, we want to alter the reply-to.
  if ($message['id'] == 'mymodule_some_key') {
    $sparkpost_message['content']['reply_to'] = 'noreply@example.com';
  }
}