public function Mailer::getFrom in Simplenews 8.2
Same name and namespace in other branches
- 8 src/Mail/Mailer.php \Drupal\simplenews\Mail\Mailer::getFrom()
- 3.x src/Mail/Mailer.php \Drupal\simplenews\Mail\Mailer::getFrom()
Build formatted from-name and email for a mail object.
Return value
array Associative array with (un)formatted from address 'address' => From address 'formatted' => Formatted, mime encoded, from name and address
Overrides MailerInterface::getFrom
1 call to Mailer::getFrom()
- Mailer::sendCombinedConfirmation in src/
Mail/ Mailer.php - Send collected confirmations.
File
- src/
Mail/ Mailer.php, line 478
Class
- Mailer
- Default Mailer.
Namespace
Drupal\simplenews\MailCode
public function getFrom() {
$address = $this->config
->get('newsletter.from_address');
$name = $this->config
->get('newsletter.from_name');
// Windows based PHP systems don't accept formatted email addresses.
$formatted_address = mb_substr(PHP_OS, 0, 3) == 'WIN' ? $address : '"' . addslashes(Unicode::mimeHeaderEncode($name)) . '" <' . $address . '>';
return [
'address' => $address,
'formatted' => $formatted_address,
];
}