Skip to content

fix(cloudflare): send named addresses as objects - #185

Open
muco-rolle wants to merge 1 commit into
adonisjs:10.xfrom
muco-rolle:fix/cloudflare-named-addresses
Open

muco-rolle wants to merge 1 commit into
adonisjs:10.xfrom
muco-rolle:fix/cloudflare-named-addresses

Conversation

@muco-rolle

Copy link
Copy Markdown

🔗 Linked issue

Closes #184

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to 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 RH was refused with 400 · 10001 email.sending.error.invalid_request_schema.

Named addresses are now sent as { address, name } objects (email-sending_EmailAddressObject), which the API accepts for from, to, cc, bcc and reply_to. Addresses without a name are still sent as plain strings. The comment on #formatRecipients is updated, since the schema settles the address key 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.x locally).

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's addressparser if you think it's worth it.

📝 Checklist

  • I have read the contribution guide.
  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloudflare transport fails for names with non-ASCII characters

1 participant