Mailgun Batch Sending: BCC Addresses Not Receiving Substituted Content

Hey folks, I’m having trouble with Mailgun’s Batch Sending feature. I’m trying to send emails to multiple recipients, including a BCC address. Here’s the thing: the main recipients get their personalized content just fine, but the BCC copy doesn’t have any of the substitutions applied. It’s like the BCC is getting a raw version of the email.

I’m using the Mailgun API to send these messages. My code looks something like this:

response = requests.post(
    f'https://api.mailgun.net/v3/{domain}/messages',
    auth=('api', api_key),
    data={
        'from': sender_email,
        'to': list(recipient_data.keys()),
        'subject': email_subject,
        'bcc': bcc_email,
        'text': '{{recipient.message}}',
        'html': '{{recipient.html_content}}',
        'recipient-variables': json.dumps(recipient_data)
    }
)

The recipient_data is a dict with all the personalized info for each recipient. Has anyone else run into this? Is there a special way to include the BCC address so it gets the substituted content too? Any help would be awesome!

I’ve dealt with this issue in my projects as well. Unfortunately, Mailgun’s batch sending doesn’t support personalization for BCC recipients. It’s a known limitation of their system.

One approach I’ve used is to send a separate, personalized email to the BCC address after the batch send. This ensures they receive the substituted content, albeit in a separate message.

Alternatively, you could consider using a different email service provider that supports BCC personalization in batch sends, if this feature is crucial for your use case. Some providers offer more flexibility in this regard.

Remember, though, that overuse of BCC can potentially impact deliverability, so it’s generally best to use it sparingly in any case.

yo, i had the same issue! turns out BCC addresses don’t get recipient-specific content in batch sends. it’s a limitation with mailgun. if u need BCCs to see personalized stuff, you might wanna send separate emails to them or use a workaround like including them as hidden recipients. kinda sucks but that’s how it is :confused:

I’ve actually encountered this limitation with Mailgun’s batch sending feature before. It’s frustrating, but there’s a workaround that’s worked well for me. Instead of using BCC, I create a separate recipient group for those addresses and include them in the ‘to’ field, but with a custom variable that flags them as ‘hidden’ recipients.

Then in my email template, I use conditional logic to hide the email addresses of these ‘hidden’ recipients when rendering the message. This way, they get the personalized content, but other recipients can’t see them. It’s a bit more work on the template side, but it solves the substitution problem for those special addresses.

Just remember to adjust your sending logic to handle these ‘hidden’ recipients differently when processing delivery reports or managing unsubscribes. It’s not perfect, but it’s been a reliable solution in my experience.