Coelacanth
Coelacanth

Reputation: 867

How to add custom headers to Mailgun emails (via API)?

I'm sending emails via Mailgun (on my Deno server), and whatever I do, I cannot pass custom headers - they are simply ignored.

Specifically, I'm trying to pass List-Unsubscribe and List-Unsubscribe-Post, but I added other headers too, just to test. Nothing is visible in Mailgun logs.

For this code:

await mailgun.send({
        to: mailgunData.email,
        from: mailgunData.from,
        subject: mailgunData.subject,
        template: ReminderEmailTemplate.Projects,
        "v:projectsLink": `${getBaseUrl()}/projects`,
        "v:projectStartLink": `${getBaseUrl()}/project-start`,
        "v:jobsLink": `${getBaseUrl()}/jobs`,
        "v:fullName": mailgunData.full_name,
        "h:List-Unsubscribe": "<http://lists.domain.tld/newsletter>, <mailto:[email protected]?subject=unsubscribe>",
        "h:List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
        "h:Precedence": "bulk",
        "h:Priority": "normal",
        "h:X-Mailgun-Tag": "newsletter",
        "h:Feedback-ID": "1234:newsletter:mailgun",
        "h:X-Mailgun-Dkim": "yes",
        "h:something": "something",
        "h:Reply-To": "[email protected]",
})

None of the headers get passed, only to, from, subject, template, and variables prefixed with v:.

I would appreciate the help - almost seems like some config is blocking headers from being passed.

Upvotes: 2

Views: 237

Answers (0)

Related Questions