Multiple recipients visible in To header despite using MailGun recipient variables for SMTP batch delivery

I’m having trouble with MailGun’s batch email feature via SMTP. Even though I’m including recipient variables in my headers, all email addresses are still showing up in the To field for every person who gets the message.

According to MailGun’s docs, using recipient variables should make each person receive their own individual email with only their address in the To field. But that’s not happening for me.

Here’s what my SMTP headers look like:

To: [email protected], [email protected]
X-Mailgun-Recipient-Variables: {
    "[email protected]":
    {
        "user_id":"98765",
        "email_address":"[email protected]",
        "name":"Alice"
    },
    "[email protected]":
    {
        "user_id":"54321",
        "email_address":"[email protected]",
        "name":"Bob"
    }
}

The variable replacement is working fine in the email content, but each recipient can see everyone else’s email address in the To header. What am I doing wrong here?

double-check your Mailgun SMTP hostname for batch sends - it should be smtp.mailgun.org, not smtp.eu.mailgun.org or any other variant. also try adding the X-Mailgun-Tag header. I’ve seen Mailgun treat messages without tags as regular group emails instead of processing them as batches, even when you’re using recipient variables.

Had the same issue migrating from SendGrid to MailGun last year. You’re probably missing the batch mode config in your SMTP client settings. MailGun needs you to explicitly enable batch processing in your SMTP library - headers alone won’t cut it. Most SMTP libraries treat multiple recipients as one message by default unless you tell them otherwise. Check your SMTP client docs for batch or individual delivery options. Also double-check you’re hitting the right MailGun SMTP server - they’ve got separate endpoints for batch vs transactional emails. Fixed it for me once I set up the SMTP client for proper batch mode.

Had this exact problem six months ago. MailGun’s SMTP batch sending won’t hide recipients just because you’re using recipient variables. You’ve got to add the X-Mailgun-Variables header too for proper batch processing. Here’s what fixed it for me: X-Mailgun-Variables: {“batch”: “true”}. Also make sure you’re hitting MailGun’s batch-specific SMTP endpoint, not the standard one. The regular endpoint treats these like group emails even with recipient variables. After I switched endpoints and added that header, each person only saw their own email in the To field.