You are here

protected function SendGridMail::parseAddress in SendGrid Integration 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Mail/SendGridMail.php \Drupal\sendgrid_integration\Plugin\Mail\SendGridMail::parseAddress()

Split an email address into it's name and address components.

1 call to SendGridMail::parseAddress()
SendGridMail::mail in src/Plugin/Mail/SendGridMail.php
Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail().

File

src/Plugin/Mail/SendGridMail.php, line 650
Implements Drupal MailSystemInterface.

Class

SendGridMail
@file Implements Drupal MailSystemInterface.

Namespace

Drupal\sendgrid_integration\Plugin\Mail

Code

protected function parseAddress($email) {
  if (preg_match(self::SENDGRID_INTEGRATION_EMAIL_REGEX, $email, $matches)) {
    return [
      $matches[2],
      $matches[1],
    ];
  }
  else {
    return [
      $email,
      ' ',
    ];
  }
}