class AmazonSesSystem in Amazon SES 7.2
Same name and namespace in other branches
- 7 includes/amazon_ses.mail.inc \AmazonSesSystem
Create system which will send mail using amazon ses api.
Hierarchy
- class \DefaultMailSystem implements MailSystemInterface
- class \AmazonSesSystem
Expanded class hierarchy of AmazonSesSystem
1 string reference to 'AmazonSesSystem'
- amazon_ses_enable in ./
amazon_ses.install - Implements hook_enable().
File
- includes/
amazon_ses.mail.inc, line 10 - Amazon SES Mail system Used by drupal core system.
View source
class AmazonSesSystem extends DefaultMailSystem {
/**
* Concatenate and wrap the e-mail body for plain-text mails.
*/
public function format(array $message) {
// Join the body array into one string.
$message['body'] = implode("\n\n", $message['body']);
$message['body'] = drupal_wrap_mail($message['body']);
return $message;
}
/**
* Send an e-mail message, using Drupal variables and default settings.
*/
public function mail(array $message) {
// Remove uneccessary parameters.
unset($message['headers']);
unset($message['params']);
unset($message['key']);
unset($message['module']);
unset($message['language']);
unset($message['id']);
$reply_to = variable_get('amazon_ses_reply_to', $message['from']);
$return_path = variable_get('amazon_ses_return_path', $message['from']);
if (!empty($reply_to)) {
$message['ReplyToAddresses'] = $reply_to;
}
if (!empty($return_path)) {
$message['ReturnPath'] = $return_path;
}
// Convert new line to br for html mail.
$message['body'] = nl2br($message['body']);
$action_parameters['mail'] = $message;
$result = amazon_ses_send_request('SendEmail', $action_parameters);
if (!empty($result['message_id'])) {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AmazonSesSystem:: |
public | function |
Concatenate and wrap the e-mail body for plain-text mails. Overrides DefaultMailSystem:: |
|
AmazonSesSystem:: |
public | function |
Send an e-mail message, using Drupal variables and default settings. Overrides DefaultMailSystem:: |
|
DefaultMailSystem:: |
protected static | function | Disallows potentially unsafe shell characters. |