Skip to content

Commit

Permalink
bug #35173 [Mailer][MailchimpBridge] Fix missing attachments when sen…
Browse files Browse the repository at this point in the history
…ding via Mandrill API (vilius-g)

This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Previous code tries to pass attachments to API, but uses incorrect structure and as a result all attachments are missing when the email is sent.

This also adds previously missing attachment names.

Commits
-------

7b1bbb6 [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API
  • Loading branch information
fabpot committed Jan 2, 2020
2 parents 08670cc + 7b1bbb6 commit e348513
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -79,10 +79,14 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array
'type' => $headers->get('Content-Type')->getBody(),
];

if ($name = $headers->getHeaderParameter('Content-Disposition', 'name')) {
$att['name'] = $name;
}

if ('inline' === $disposition) {
$payload['images'][] = $att;
$payload['message']['images'][] = $att;
} else {
$payload['attachments'][] = $att;
$payload['message']['attachments'][] = $att;
}
}

Expand Down

0 comments on commit e348513

Please sign in to comment.