Sagar Singh
Sagar Singh

Reputation: 41

How can increase the limit in mailgun message send option?

I have integrated the Mailgun with Nodejs and I send the data of more than 16kb in the dynamic data using the 'h:X-Mailgun-Variables' and got the limitation error. Please help me with how can I increase the limit?

Error:

{
    "message": "Send options (parameters starting with o:, h:, or v:) are limited to 16 kB total'
}
{
    "from" : "[email protected]",
    "to" : "[email protected]",
    "subject" : "test subject",
    "template" : "tempname",
    "h:X-Mailgun-Variables" : JSON.stringify({ data })
}

Upvotes: 0

Views: 673

Answers (1)

Sagar Singh
Sagar Singh

Reputation: 41

I have found a solution to send emails with more than 16 kb of data with the help of this Mailgun API please use this API who are facing issues with Mailgun email data limits

URL:- https://documentation.mailgun.com/en/latest/user_manual.html#templates

Code:-

const API_KEY = 'YOUR_API_KEY';
const DOMAIN = 'YOUR_DOMAIN_NAME';

const formData = require('form-data');
const Mailgun = require('mailgun.js');

const mailgun = new Mailgun(formData);
const client = mailgun.client({ username: 'api', key: API_KEY });
const title = 'title value';
const slug = 'slug value';

const data = {
  from: 'Excited User <[email protected]>',
  to: '[email protected]',
  subject: `Email ${title}`,
  template: 'name-of-the-template-you-made-in-mailgun-web-portal',
  't:variables': JSON.stringify({ // be sure to stringify your payload
    title,
    slug,
  })
};

client.messages.create(DOMAIN, data).then((res) => {
  console.log(res);
})
  .catch((err) => {
    console.error(err);
  });

Upvotes: 4

Related Questions