Maksim Nesterenko
Maksim Nesterenko

Reputation: 6213

How to use custom mailgun variable inside email template?

I'm using mailgun-js library to send emails from nodejs server.

How I can populate html email teamplate, which sends through mailgun, with some custom variable?

For recipient-variables it works like %recipient.custom-variable% in html template and with such code on server side:

let email = {
  from: '[email protected]',
  to: emailsArray,
  subject: 'my subject',
  html: template,
  'recipient-variables': emailsArray.map(e=>{e:{custom-variable: user.customThing}})
};

return mailgun.create(email);

but I have some variable which should be the same for all recipients.

How I can set the custom variable and how I can use it inside template (in manner of recipient-variable)?

Upvotes: 1

Views: 2006

Answers (1)

Maksim Nesterenko
Maksim Nesterenko

Reputation: 6213

It seems like it's not possible to use custom variables, only with recipient-variables.

Upvotes: 0

Related Questions