Repository navigation
fix(cloudflare): send named addresses as objects - #185
Open
muco-rolle wants to merge 1 commit into
Open
muco-rolle wants to merge 1 commit into
muco-rolle wants to merge 1 commit into
Conversation
Cloudflare's send API accepts an address as a printable ASCII string or as
an { address, name } object. The transport formatted named addresses as
"Name <email>" strings, so a name like "Équipe RH" was refused with
email.sending.error.invalid_request_schema.
Closes adonisjs#184
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Closes #184
❓ Type of change
📚 Description
The Cloudflare transport sent a named address as a
"Name <email>"string. Cloudflare's send API only accepts printable ASCII in a plain string (email-sending_EmailAddressString, pattern^[\x20-\x7E]+$), so a name likeÉquipe RHwas refused with400 · 10001 email.sending.error.invalid_request_schema.Named addresses are now sent as
{ address, name }objects (email-sending_EmailAddressObject), which the API accepts forfrom,to,cc,bccandreply_to. Addresses without a name are still sent as plain strings. The comment on#formatRecipientsis updated, since the schema settles theaddresskey it was unsure about.The existing recipients test now expects objects, and a new test covers a non-ASCII name. The Cloudflare tests pass; the rest of the suite is unchanged (the integration tests that need provider credentials fail the same way on
10.xlocally).Recipients given as
"Name <email>"strings are still forwarded as is, like in the other JSON transports, and Brevo and SparkPost would need the same treatment. Happy to send a follow-up that parses them with Nodemailer'saddressparserif you think it's worth it.📝 Checklist