You are here

public function MailEntity::getFromFormatted in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::getFromFormatted()
  2. 8 src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::getFromFormatted()

Returns the formatted from mail address.

Return value

string The mail address with a name.

Overrides MailInterface::getFromFormatted

1 call to MailEntity::getFromFormatted()
MailEntity::getHeaders in src/Mail/MailEntity.php
Returns the mail headers.

File

src/Mail/MailEntity.php, line 172

Class

MailEntity
Default mail class for entities.

Namespace

Drupal\simplenews\Mail

Code

public function getFromFormatted() {

  // Windows based PHP systems don't accept formatted email addresses.
  if (mb_substr(PHP_OS, 0, 3) == 'WIN') {
    return $this
      ->getFromAddress();
  }
  return '"' . addslashes(Unicode::mimeHeaderEncode($this
    ->getNewsletter()->from_name)) . '" <' . $this
    ->getFromAddress() . '>';
}