-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer][SendGrid] add support for scheduling delivery via send_at
API parameter
#60372
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
base: 7.3
Are you sure you want to change the base?
Conversation
Test failures look unrelated |
New features need to target the newest branch, which is 7.3 |
src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridApiTransportTest.php
Show resolved
Hide resolved
src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php
Outdated
Show resolved
Hide resolved
} | ||
// the documentation shows parameter names in camelCase but the expected JSON keys should be in snake_case | ||
$payload['send_at'] = $header->getDateTime()->getTimestamp(); | ||
} elseif ($header instanceof TagHeader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using guard clauses, instead of nested conditions, to improve readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,thank you for your suggestion.
I didn't want to change too much of the code to facilitate the review process but I'll gladly update the successive conditions if necessary. Is it something you would like me to do in this PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a suggestion, but since you've added new conditions, this approach might make sense, as it's used in other integrations. I think it's worth waiting to hear and consider other opinions before making a final decision.
50ac018
to
a317491
Compare
@OskarStark @bkosun Thank you for your feedback, I've applied all the suggested changes. Let me know if you would like me to make additional changes. |
Is this Send-At header supported by their SMTP server ? |
Hi @stof, Yes, the Send-At header is supported by their SMTP server as well, as per the documentation :
|
send_at
API parameter
This PR adds support for scheduling delivery when using the SendGrid API transport (with a
sendgrid+api
DSN), by providing a\DateTimeInterface
object in aSymfony\Component\Mime\Header\DateHeader
namedSend-At
.It will be mapped to the
send_at
parameter of the[POST] /mail/send
API endpoint.