Skip to content

Commit

Permalink
bug #34034 [Mailer][MailchimpBridge] Don't send address names if empt…
Browse files Browse the repository at this point in the history
…y string (ogizanagi)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer][MailchimpBridge] Don't send address names if empty string

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | #34029 (comment) <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | N/A

Commits
-------

197d123 [Mailer][MailchimpBridge] Don't send address names if empty string
  • Loading branch information
fabpot committed Oct 22, 2019
2 parents effae8a + 197d123 commit 2931227
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -75,12 +75,15 @@ private function getPayload(Email $email, Envelope $envelope): array
'html' => $email->getHtmlBody(),
'text' => $email->getTextBody(),
'subject' => $email->getSubject(),
'from_name' => $envelope->getSender()->getName(),
'from_email' => $envelope->getSender()->getAddress(),
'to' => $this->getRecipients($email, $envelope),
],
];

if ('' !== $envelope->getSender()->getName()) {
$payload['message']['from_name'] = $envelope->getSender()->getName();
}

foreach ($email->getAttachments() as $attachment) {
$headers = $attachment->getPreparedHeaders();
$disposition = $headers->getHeaderBody('Content-Disposition');
Expand Down Expand Up @@ -122,10 +125,13 @@ protected function getRecipients(Email $email, Envelope $envelope): array

$recipientPayload = [
'email' => $recipient->getAddress(),
'name' => $recipient->getName(),
'type' => $type,
];

if ('' !== $recipient->getName()) {
$recipientPayload['name'] = $recipient->getName();
}

$recipients[] = $recipientPayload;
}

Expand Down

0 comments on commit 2931227

Please sign in to comment.