Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mailer] Fixed mandrill api header structure #37900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

wulff
Copy link
Contributor

@wulff wulff commented Aug 20, 2020

Q A
Branch? 5.1
Bug fix? yes
New feature? no
Deprecations? no
License MIT

When using the Mandrill API transport, it is not possible to set a reply-to address.

How to reproduce
Create a new email and add a reply-to address:

$email = (new Email())
    ->from('[email protected]')
    ->to('[email protected]')
    ->replyTo('[email protected]')
    ->subject('subject')
    ->text('text');
$mailer->send($email);

The expected result is a payload which contains the following headers:

"headers": {
    "reply-to": "[email protected]"
}

But instead, the getPayload() method produces these headers:

"headers": [
    "reply-to: [email protected]"
]

Additional context
See https://mandrillapp.com/api/docs/messages.html.

@stof stof added this to the 4.4 milestone Aug 20, 2020
@dmaicher
Copy link
Contributor

There is a test failure though:

Testing src/Symfony/Component/Mailer

.......................................................E.......  63 / 237 ( 26%)

............................................................... 126 / 237 ( 53%)

............................................................... 189 / 237 ( 79%)

.SS...........S.........SS......................                237 / 237 (100%)

Time: 1.32 seconds, Memory: 10.00 MB

There was 1 error:

1) Symfony\Component\Mailer\Bridge\Mailchimp\Tests\Transport\MandrillApiTransportTest::testCustomHeader

Undefined offset: 0

/home/travis/build/symfony/symfony/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php:68

@wulff
Copy link
Contributor Author

wulff commented Aug 20, 2020

I have updated the relevant test case, but now the Travis test fails on an unrelated test: https://travis-ci.org/github/symfony/symfony/jobs/719745366#L7547.

Copy link
Contributor

@dmaicher dmaicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other test failures seem unrelated

@dmaicher
Copy link
Contributor

@wulff can you rebase this to 4.4? There the issue also exists, right?

@fabpot fabpot changed the base branch from 5.1 to 4.4 August 21, 2020 06:31
@fabpot fabpot force-pushed the mailer/fix-mandrill-headers branch from 60c4191 to aeb4c5e Compare August 21, 2020 06:31
@fabpot
Copy link
Member

fabpot commented Aug 21, 2020

Thank you @wulff.

@fabpot fabpot merged commit 1f4c616 into symfony:4.4 Aug 21, 2020
@@ -111,7 +111,7 @@ private function getPayload(Email $email, Envelope $envelope): array
continue;
}

$payload['message']['headers'][] = $name.': '.$header->getBodyAsString();
$payload['message']['headers'][$name] = $header->getBodyAsString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does Mandrill handle several headers with the same name? Here you will only ever get the last one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, Mandrill only allows one of each header in the headers field.

This was referenced Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants