public function MandrillAPI::sendTemplate in Mandrill 8
Sends 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:
string $template_id:
array $template_content:
Return value
array Array of message objects, one per recipient.
Overrides MandrillAPIInterface::sendTemplate
1 method overrides MandrillAPI::sendTemplate()
- MandrillTestAPI::sendTemplate in src/
MandrillTestAPI.php - Sends a templated Mandrill message.
File
- src/
MandrillAPI.php, line 465
Class
- MandrillAPI
- Service class to integrate with Mandrill.
Namespace
Drupal\mandrillCode
public function sendTemplate($message, $template_id, $template_content) {
$result = NULL;
try {
if ($mandrill = $this
->getAPIObject()) {
$result = $mandrill->messages
->sendTemplate($template_id, $template_content, $message);
}
} catch (\Exception $e) {
\Drupal::messenger()
->addError(t('Mandrill: %message', array(
'%message' => $e
->getMessage(),
)));
$this->log
->error($e
->getMessage());
}
return $result;
}