anymail / django-anymail

Django email backends and webhooks for Amazon SES, Brevo (Sendinblue), MailerSend, Mailgun, Mailjet, Postmark, Postal, Resend, SendGrid, SparkPost, Unisender Go and more
https://anymail.dev
BSD 3-Clause "New" or "Revised" License
1.65k stars 125 forks source link

Support Brevo batch sending with merge_data #353

Closed waldeck-dev closed 6 months ago

waldeck-dev commented 7 months ago

Hi,

I'm reaching out to report a potential issue I encountered while reading the Anymail docs (for use with Brevo). This is my first time working with both Anymail and Brevo, so I might be getting it all wrong.

The documentation states (here) that Brevo does not support per-recipient variables, and we shouldn't use merge_data.

From what I understood from the Brevo documentation (here), it looks like per-recipient params are supported (using params in each subobjects of messageVersions).

As of my writing, this section of the Brevo documentation was updated one month ago. Is this a feature that was recently supported, or am I misunderstanding something?

medmunds commented 7 months ago

It looks like Brevo recently added batch sending support (via a new messageVersions field in their sending API). Thanks for pointing it out.

We'll need to update Anymail's Brevo backend to add support for this. Anymail's merge_data will flow into Brevo's per-recipient params, as you've noted. I'm not sure whether Anymail's merge_metadata (per-recipient metadata) can be supported. Metadata uses Brevo's X-Mailin-custom email header, and Brevo's docs don't indicate that headers can be customized per recipient in messageVersions. (But it's worth testing—docs are often incomplete.)

medmunds commented 5 months ago

(Released in Anymail 10.3)