Skip to content
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

Manage address/name recipients array in SymfonyMailerAdapter #259

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

lanfisis
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets no
License MIT

Context

I'm currently working on the upgrade of a Sylius v1.10 to Sylius 1.12. Since Sylius use Symfony Mailer instead of Swift Mailer, we encounter the following bug: before the upgrade, we use

['[email protected]' => 'John Doe', '[email protected]' => 'Jane Smith']

array for the $recipients parameter of the \Sylius\Component\Mailer\Sender\Sender::send method, and it was working like a charm.

Problem

After the upgrade, Symfony Mailer \Symfony\Component\Mime\Email object used in \Sylius\Bundle\MailerBundle\Sender\Adapter\SymfonyMailerAdapter::sendMessage is looking for a \Symfony\Component\Mime\Address objects or strings. With an array like above, it tries to use 'John Doe' or 'Jane Smith' as email and the following exception is thrown:

image

Fix

I've added a function to format address => name like array value to an Address object. Only address value are not touched.

@lanfisis lanfisis requested a review from a team as a code owner September 18, 2024 15:32
@GSadee GSadee changed the base branch from 3.0 to 2.1 September 24, 2024 08:31
@GSadee
Copy link
Member

GSadee commented Sep 24, 2024

The base of this pull-request was changed, you need fetch and reset your local branch
if you want to add new commits to this pull request. Reset before you pull, else commits
may become messed-up.

Unless you added new commits (to this branch) locally that you did not push yet,
execute git fetch origin && git reset "3.0" to update your local branch.

Feel free to ask for assistance when you get stuck 👍

@GSadee GSadee added the Bug Confirmed bugs or bugfixes. label Sep 24, 2024
@GSadee GSadee merged commit 12d58c7 into Sylius:2.1 Sep 24, 2024
29 checks passed
@GSadee
Copy link
Member

GSadee commented Sep 24, 2024

Thank you, David! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants