Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mailer] Sendgrid API Transport: allow use of mail_settings#42915

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
mikefox wants to merge15 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
frommikefox:mailer-sendgrid-api-transport-allow-mail-settings

Conversation

mikefox
Copy link

@mikefoxmikefox commentedSep 7, 2021
edited
Loading

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#42854
LicenseMIT
Doc PRsymfony/symfony-docs#...

The Sendgrid APIallows filters to be sent via themail_settings field when sending an email. This change allows users of the Sendgrid API mail transport to use this setting by setting amail_settings text header on an email. This will be transformed into an array value that's sent as the mail_setting parameter.

@carsonbotcarsonbot changed the title[MAILER] Sendgrid API Transport: allow use of mail_settings[Mailer] Sendgrid API Transport: allow use of mail_settingsSep 7, 2021
@mikefoxmikefoxforce-pushed themailer-sendgrid-api-transport-allow-mail-settings branch 2 times, most recently from6f80065 to5634789CompareSeptember 7, 2021 13:17
@carsonbot
Copy link

Hey!

I think@versgui has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@nicolas-grekasnicolas-grekas added this to the5.4 milestoneSep 17, 2021
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Passing this as a fake header is a bit hacky I suppose, but I don't have a better idea. Can you please add some test cases? And can you also please send a PR for the doc?

@fabpot
Copy link
Member

I'm also not a big fan of using a fake header. In any case, we don't add specific features of providers as we want devs to be able to switch from one provider to another one. But if this feature could be added to many providers, then, let's think about a proper way to support it. But the first step is to really understand if this can be supported by more than just Sendgrid.

@mikefox
Copy link
Author

@fabpot@nicolas-grekas I think a less hacky version would require adding a new optional property to theSymfony\Component\Mime\Message class that allows you to set provider-specific instructions that can be used in the provider's transport class. If you agree I can put something together in this PR.

@mikefoxmikefoxforce-pushed themailer-sendgrid-api-transport-allow-mail-settings branch from8cf95ef to80e4083CompareSeptember 20, 2021 08:37
@mikefoxmikefoxforce-pushed themailer-sendgrid-api-transport-allow-mail-settings branch from80e4083 to54e8c9cCompareOctober 8, 2021 16:49
@mikefox
Copy link
Author

mikefox commentedOct 8, 2021
edited
Loading

A better solution that's extensible for other transport providers.

@mikefox
Copy link
Author

@fabian@nicolas-grekas any thoughts on this?

@fabpot
Copy link
Member

I'm still not sure this is something we want to support. In any case, this is probably not something that can be part of the Envelope.

@fabpotfabpot modified the milestones:5.4,6.1Nov 3, 2021
@mikefoxmikefoxforce-pushed themailer-sendgrid-api-transport-allow-mail-settings branch from4b7cd65 toc009262CompareDecember 2, 2021 10:03
@mikefox
Copy link
Author

@nicolas-grekas Thanks for your comments, I've addressed your feedback.

@fabpotfabpot modified the milestones:6.1,6.2May 20, 2022
@MaximePinot
Copy link
Contributor

MaximePinot commentedJul 5, 2022
edited
Loading

Friendly ping@nicolas-grekas and@fabpot. What do you think of@mikefox's implementation?

I can help with this PR. I would also like to be able to use themail_settings field.

EDIT: Eventually did it with a decorated HttpClient and a CompilerPass:https://gist.github.com/MaximePinot/85ef21d21f06ada31c097709769eb084

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Here are some comments. This PR is related to#41714
@fabpot I think we need to figure out a way for Mailer to support those features. Eg templates: I don't think we can abstract them in the component, but support for them looks desired. The code is almost capable of doing it. Can we reconsider the rejection of such changes, as done in#41714?

cvergne reacted with eyes emoji
@@ -1,6 +1,12 @@
CHANGELOG
=========

6.1

Choose a reason for hiding this comment

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

6.2 now

6.1
---

* Check the `Envelope` options for a "mail_settings" property and send the

Choose a reason for hiding this comment

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

missing space at head of line
the description is misleading I think: the code doesn't check formail_settings anywhere

@@ -145,6 +145,10 @@ private function getPayload(Email $email, Envelope $envelope): array
$personalization['custom_args'] = $customArguments;
}

foreach ($envelope->getOptions() as $name => $value) {
$payload[$name] = $value;

Choose a reason for hiding this comment

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

This allows overriding any pre-existing payload key. This might be too risky.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this instead?

Suggested change
$payload[$name] =$value;
if (!array_key_exists($name,$payload) {
$payload[$name] =$value;
}

@@ -1,6 +1,11 @@
CHANGELOG
=========

6.1

Choose a reason for hiding this comment

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

6.2

6.1
---

* Added the `options` property to `Envelope`

Choose a reason for hiding this comment

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

missing space

@MaximePinotMaximePinotforce-pushed themailer-sendgrid-api-transport-allow-mail-settings branch from568a523 to21063b6CompareJuly 9, 2022 10:06
@nicolas-grekasnicolas-grekas modified the milestones:6.2,6.3Nov 5, 2022
@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@xabbuhxabbuh modified the milestones:7.1,7.2May 15, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@MaximePinotMaximePinotMaximePinot left review comments

@chalasrchalasrAwaiting requested review from chalasr

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

[Mailer] SendGrid bypass suppressions
6 participants
@mikefox@carsonbot@fabpot@MaximePinot@nicolas-grekas@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp