class BusinessRulesMail in Business Rules 8
Same name and namespace in other branches
- 2.x src/Plugin/Mail/BusinessRulesMail.php \Drupal\business_rules\Plugin\Mail\BusinessRulesMail
Provides a 'Business Rules Mail' plugin to send emails.
Plugin annotation
@Mail(
id = "business_rules_mail",
label = @Translation("Business Rules Mailer"),
description = @Translation("Business Rules Mailer Plugin.")
)
Hierarchy
- class \Drupal\Core\Mail\Plugin\Mail\PhpMail implements MailInterface
- class \Drupal\business_rules\Plugin\Mail\BusinessRulesMail implements MailInterface
Expanded class hierarchy of BusinessRulesMail
File
- src/
Plugin/ Mail/ BusinessRulesMail.php, line 18
Namespace
Drupal\business_rules\Plugin\MailView source
class BusinessRulesMail extends PhpMail implements MailInterface {
/**
* Formats a message composed by drupal_mail().
*
* @param array $message
* A message array holding all relevant details for the message.
*
* @return array
* The message as it should be sent.
*/
public function format(array $message) {
// Join the body array into one string.
$message['body'] = implode("\n\n", $message['body']);
if (!isset($message['headers']) || !isset($message['headers']['Content-Type']) || !stristr($message['headers']['Content-Type'], 'text/html')) {
// Convert any HTML to plain-text.
$message['body'] = MailFormatHelper::htmlToText($message['body']);
// Wrap the mail body for sending.
$message['body'] = MailFormatHelper::wrapMail($message['body']);
}
return $message;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BusinessRulesMail:: |
public | function |
Formats a message composed by drupal_mail(). Overrides PhpMail:: |
|
PhpMail:: |
protected | property | The configuration factory. | |
PhpMail:: |
public | function |
Sends an email message. Overrides MailInterface:: |
2 |
PhpMail:: |
protected static | function | Disallows potentially unsafe shell characters. | |
PhpMail:: |
public | function | PhpMail constructor. |