node.jsmailchimpmandrill

How to send bulk mails using Mandrill for custom merge_vars for all


i want to send mail to 10000+ recepient's with 10000+ custom mergevar in a single mandril.sendTemplate API call


Solution

  • yeah i tried for small amount of users ..but for bulk 10000+ API calls not possible right?and I tried that also but not working for bulk

    True you might run into some very real RAM issues but way before that some rate limiting issues I think.. you could do something like the pseudo code below which deals with a couple at a time(assuming sending mails would be some api request)

    async function bulkEmail(mailList){
      const temp=[];
      for(let i=0;i<mailList.length;i++){
        if(temp.length===500){ //the maximum amount of api requests that will be sent without waiting for a single one to finish
          await Promise.allResolved(temp);
          temp.length=0; //clear the array to take a next chunk of 500
        }
        temp.push(somePromiseMadeFromAPICallToEmail(mailList[i]));
      }
    }