function mandrill_get_api_object in Mandrill 7
Same name and namespace in other branches
- 8 mandrill.module \mandrill_get_api_object()
- 6 mandrill.module \mandrill_get_api_object()
- 7.2 mandrill.module \mandrill_get_api_object()
Return Mandrill API object for communication with the mailchimp server.
Parameters
bool $reset: Pass in TRUE to reset the statically cached object.
string $classname: The Mandrill class to use for sending emails. Passing a parameter allows the class used to be overridden, E.g., for tests.
Return value
Mandrill|bool Mandrill Object upon success FALSE if variable_get('mandrill_api_key') is unset
Throws
7 calls to mandrill_get_api_object()
- MandrillMailSystem::mail in lib/
mandrill.mail.inc - Send the email message.
- mandrill_activity_get_activity in modules/
mandrill_activity/ mandrill_activity.module - Return all activity on all lists for a given email address.
- mandrill_get_subaccounts in ./
mandrill.module - Get a list of subaccounts.
- mandrill_get_templates in ./
mandrill.module - Get a list of mandrill template objects.
- mandrill_reports_data in modules/
mandrill_reports/ mandrill_reports.module - Return an associative array containing raw stats.
File
- ./
mandrill.module, line 240 - Enables Drupal to send email directly through Mandrill.
Code
function mandrill_get_api_object($reset = FALSE, $classname = 'DrupalMandrill') {
$api =& drupal_static(__FUNCTION__, NULL);
if ($api === NULL || $reset === TRUE) {
$api_key = variable_get('mandrill_api_key', '');
$api_timeout = variable_get('mandrill_api_timeout', 60);
if (empty($api_key)) {
return FALSE;
}
$api = new $classname($api_key, $api_timeout);
}
return $api;
}