question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Batch sending - Recipient variables

See original GitHub issue

Hi, Is it possible with mailgun-js to batch send emails to multiple addresses, but have each person to see only their email address in the ‘to’ field.

As mentioned in mailgun doc (https://documentation.mailgun.com/en/latest/user_manual.html?highlight=batch sending#batch-sending => section Batch Sending) :

Warning It is important when using Batch Sending to also use Recipient Variables. This tells Mailgun to send each recipient an individual email with only their email in the to field. If they are not used, all recipients’ email addresses will show up in the to field for each recipient.

To achieve this, we should be able to send an object like this in the “to” field : { "user1@example.com" : {"unique_id": "ABC123456789"}, "user2@example.com" : {"unique_id": "ZXY987654321"} }

I’d rather do this and call the api once than calling it once for each recipient.

I can’t find a way to do this with the js library. Is it possible ?

Thanks !

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
thrOocommented, Feb 9, 2021

Hi, I have had the same problem, but this works here too. It’s a bit confusing since the Package documentation differs from the main one on their main homepage.

This my sendingData and it works for me as intended (each recipient only sees their mail address and I have only one API-call):

Screenshot from 2021-02-09 13-00-13

0reactions
chrishawncommented, Mar 23, 2021

OK you are correct, i had 2 issues

  1. make sure recipient-variables is spelled right and stringified
  2. i assumed recipient-variables was an array, i can see now that it is an object. Once I fixed that it worked.
Read more comments on GitHub >

github_iconTop Results From Across the Web

MailGun SMTP batch sending with Recipient Variables shows ...
I am trying to get Batch Sending to work over SMTP, but even though I'm sending to multiple recipients and I've specified user...
Read more >
Recipient Variables to batch emails? · Issue #101 - GitHub
I'm trying to send batch emails that would make use of variables, such as %recipient.firstname% etc, as described here.
Read more >
User Manual — Mailgun API documentation
Recipient Variables are custom variables that you define, which you can then reference in the message body. They give you the ability to...
Read more >
Part 2 - Send Emails in Batch using Mailgun API - YouTube
The text-based version of this tutorial: https://www.frankdu.co/tutorial/batchsending_mailgun/The GitHub link of the whole mailgun series: ...
Read more >
Mailgun for batch emails - Laracasts
Hello folks, I just tried to implement Mailgun for batch sending using this library ... and their corresonding values are an array of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found