protected function SendGridMail::parseAddress in SendGrid Integration 8.2
Same name and namespace in other branches
- 8 src/Plugin/Mail/SendGridMail.php \Drupal\sendgrid_integration\Plugin\Mail\SendGridMail::parseAddress()
Split an email address into it's name and address components. Returns an array with the first element as the email address and the second element as the name.
Parameters
$email string:
Return value
mixed
1 call to SendGridMail::parseAddress()
- SendGridMail::mail in src/
Plugin/ Mail/ SendGridMail.php
File
- src/
Plugin/ Mail/ SendGridMail.php, line 741 - Implements Drupal MailSystemInterface.
Class
- SendGridMail
- @file Implements Drupal MailSystemInterface.
Namespace
Drupal\sendgrid_integration\Plugin\MailCode
protected function parseAddress(string $email) {
if (preg_match(self::SENDGRID_INTEGRATION_EMAIL_REGEX, $email, $matches)) {
return [
$matches[2],
strval($matches[1]),
];
}
else {
return [
$email,
];
}
}