bug #35173 [Mailer][MailchimpBridge] Fix missing attachments when sending 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
-------

7b1bbb6190 [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API
This commit is contained in:
Fabien Potencier 2020-01-02 19:35:45 +01:00
commit e348513157

View File

@ -79,10 +79,14 @@ class MandrillTransport extends AbstractApiTransport
'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;
}
}