Skip to content

Commit 2931227

Browse files
committed
bug #34034 [Mailer][MailchimpBridge] Don't send address names if empty 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
2 parents effae8a + 197d123 commit 2931227

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ private function getPayload(Email $email, Envelope $envelope): array
7575
'html' => $email->getHtmlBody(),
7676
'text' => $email->getTextBody(),
7777
'subject' => $email->getSubject(),
78-
'from_name' => $envelope->getSender()->getName(),
7978
'from_email' => $envelope->getSender()->getAddress(),
8079
'to' => $this->getRecipients($email, $envelope),
8180
],
8281
];
8382

83+
if ('' !== $envelope->getSender()->getName()) {
84+
$payload['message']['from_name'] = $envelope->getSender()->getName();
85+
}
86+
8487
foreach ($email->getAttachments() as $attachment) {
8588
$headers = $attachment->getPreparedHeaders();
8689
$disposition = $headers->getHeaderBody('Content-Disposition');
@@ -122,10 +125,13 @@ protected function getRecipients(Email $email, Envelope $envelope): array
122125

123126
$recipientPayload = [
124127
'email' => $recipient->getAddress(),
125-
'name' => $recipient->getName(),
126128
'type' => $type,
127129
];
128130

131+
if ('' !== $recipient->getName()) {
132+
$recipientPayload['name'] = $recipient->getName();
133+
}
134+
129135
$recipients[] = $recipientPayload;
130136
}
131137

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy