Allow full name to be passed to mailer

[MAILPOET-2307]
This commit is contained in:
Pavel Dohnal
2019-09-04 15:53:11 +02:00
committed by Jack Kitterhing
parent 0b96d13d1a
commit ef29a301fc
2 changed files with 9 additions and 2 deletions

View File

@@ -174,8 +174,9 @@ class Mailer {
if (isset($subscriber['address'])) $subscriber['email'] = $subscriber['address'];
$first_name = (isset($subscriber['first_name'])) ? $subscriber['first_name'] : '';
$last_name = (isset($subscriber['last_name'])) ? $subscriber['last_name'] : '';
if (!$first_name && !$last_name) return $subscriber['email'];
$full_name = sprintf('%s %s', $first_name, $last_name);
$full_name = (isset($subscriber['full_name'])) ? $subscriber['full_name'] : null;
if (!$first_name && !$last_name && !$full_name) return $subscriber['email'];
$full_name = is_null($full_name) ? sprintf('%s %s', $first_name, $last_name) : $full_name;
$full_name = trim(preg_replace('!\s\s+!', ' ', $full_name));
$full_name = $this->encodeAddressNamePart($full_name);
$subscriber = sprintf(