如何使用Mandrill为所有人自定义merge_var发送批量邮件



我想在一个mandril.sendTemplate API调用中用10000多个自定义mergevar向10000多个收件人发送邮件

是的,我为少量用户尝试过。。但是对于批量10000+API调用是不可能的,对吗?我也尝试过,但没有为批量工作

没错,你可能会遇到一些非常真实的RAM问题,但在此之前,我认为会遇到一些速率限制问题。。你可以做一些类似下面的伪代码的事情,它一次处理一对夫妇(假设发送邮件是一些api请求(

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]));
}
}

最新更新