You are here

function sparkpost_mail in Sparkpost email 8.2

Same name and namespace in other branches
  1. 7.2 sparkpost.module \sparkpost_mail()
  2. 7 sparkpost.module \sparkpost_mail()

Implements hook_mail().

1 string reference to 'sparkpost_mail'
TestMailSystemOverride::loadOverrides in src/TestMailSystemOverride.php
Returns config overrides.

File

./sparkpost.module, line 29
Contains sparkpost.module.

Code

function sparkpost_mail($key, &$message, $params) {
  if ($key == 'test_mail_form') {
    $message['subject'] = $params['subject'];
    $message['body'][] = $params['body'];
    if ($params['include_attachment']) {
      $message['attachments'][] = \Drupal::service('file_system')
        ->realpath('core/misc/druplicon.png');
      $message['body'][] = t('The Drupal icon is included as an attachment to test the attachment functionality.');
    }
  }
}