You are here

function mandrill_template_sender in Mandrill 7.2

Same name and namespace in other branches
  1. 7 modules/mandrill_template/mandrill_template.module \mandrill_template_sender()

Send a templated Mandrill message.

This function checks for appropriate settings in the message, then uses the template API call to send the message if the settings are valid.

Parameters

array $message: Mandrill message to send.

string $template_id: Name of the template to use.

array $template_content: Associative array mapping template regions and content.

Return value

array Message response.

2 calls to mandrill_template_sender()
MandrillTemplateTestCase::testSendTemplatedMessage in modules/mandrill_template/tests/mandrill_template.test
Test sending a templated message to multiple recipients.
MandrillTemplateTestCase::testSendTemplatedMessageInvalidTemplate in modules/mandrill_template/tests/mandrill_template.test
Test sending a templated message using an invalid template.
1 string reference to 'mandrill_template_sender'
mandrill_template_mandrill_mail_alter in modules/mandrill_template/mandrill_template.module
Implements hook_mandrill_mail_alter().

File

modules/mandrill_template/mandrill_template.module, line 190
Enables Drupal to send email using Mandrill's template system.

Code

function mandrill_template_sender($message, $template_id, $template_content) {
  if ($mailer = mandrill_get_api_object()) {
    return $mailer->messages
      ->sendTemplate($template_id, $template_content, $message);
  }
  return NULL;
}