function sendgrid_integration_mail in SendGrid Integration 8
Same name and namespace in other branches
- 8.2 sendgrid_integration.module \sendgrid_integration_mail()
- 7 sendgrid_integration.module \sendgrid_integration_mail()
Implements hook_mail().
File
- ./
sendgrid_integration.module, line 30 - Main module file for SendGrid Integration.
Code
function sendgrid_integration_mail($key, &$message, $params) {
$message['module'] = 'sendgrid_integration';
$message['key'] = $key;
$message['subject'] = $params['subject'];
$message['body'] = explode(Settings::get('mail_line_endings', PHP_EOL) . Settings::get('mail_line_endings', PHP_EOL), $params['body']);
if ($params['include_test_attachment']) {
$message['attachments'][] = \Drupal::service('file_system')
->realpath('core/misc/druplicon.png');
}
if (isset($params['Reply-To']) && !empty($params['Reply-To'])) {
$message['headers']['Reply-To'] = $params['Reply-To'];
}
else {
if (isset($params['reply_to']) && !empty($params['reply_to'])) {
$message['headers']['Reply-To'] = $params['reply_to'];
}
}
}