I have encountered a similar issue previously. Mailgun’s API does not support variable substitutions in the BCC field because it processes substitutions only for visible recipient fields like the ‘to’ field. This limitation exists since batch emails using envelope variables only apply customizations to primary recipients to avoid any potential leakage, or simply as a design choice. In my experience, the only solution is to send separate messages instead of relying on BCC to include personalized content. That way you ensure each recipient receives the correctly interpolated data.
My experience with Mailgun batch emailing confirms that substitutions in the BCC field simply do not occur. Mailgun processes content variables only for the explicitly addressed recipients, likely for privacy reasons and consistency in the email logic. To achieve personalized content for what would normally be BCC recipients, I have restructured my approach to send individual emails or to use the primary recipient field while managing personalization externally. While this method increases the number of API calls, it reliably ensures that every email contains the correct personalized data.
hey, im not totally sure but it seems mailgun avoids variable interp in bcc to prevent data exposure. i ended up sending individial emails when personalization was needed. its a pain, but works for me.