Developers5 min read•Audience: Developers
Using PostBrix with Mailgun
Send PostBrix email templates through Mailgun API using recipient variables and batch sending.
Key Takeaways
- Send PostBrix compiled HTML via Mailgun’s Messages API using the "html" parameter.
- Mailgun supports batch personalization via %recipient.var% syntax or native Mailgun templates.
- Unsubscribe links use Mailgun’s tracking tags: %tag_unsubscribe_url%.
Sending via Mailgun Messages API#
When sending via Mailgun in Node.js or cURL:
code
bash
Batch Personalization with Recipient Variables#
Mailgun allows batch sending to thousands of recipients in a single API call using recipient-variables:
- In your HTML: Use
%recipient.first_name%or%recipient.tracking_link%. - In your API payload: Pass a JSON map of recipient data keyed by email address.
- Mailgun substitutes the values dynamically per recipient on their edge servers.
Frequently Asked Questions
Does Mailgun provide a built-in unsubscribe link tag?
Yes. Use %tag_unsubscribe_url% inside an anchor href to activate Mailgun’s automatic unsubscribe tracking.
Can I upload PostBrix templates to Mailgun’s template storage API?
Yes. Use Mailgun’s POST /v3/:domain/templates endpoint to store PostBrix HTML and reference it via the template parameter.