简体   繁体   English

AWS SES 计划发送电子邮件(节点 SDK)

[英]AWS SES Schedule sending of email (Node SDK)

Simple as that, I am using AWS SDK in Node to make a Lambda procedure that is in charge of sending emails according to data it receives.就这么简单,我在 Node 中使用 AWS SDK 来创建一个 Lambda 程序,负责根据收到的数据发送电子邮件。

I would like to 'delay' that email, delivering in a date and time received, not in the specific moment that the function was called.我想“延迟”那封电子邮件,在收到的日期和时间发送,而不是在调用该函数的特定时刻。 The Date and Time to deliver are parameters received by the function.要交付的日期和时间是函数接收的参数。 Any thoughts?有什么想法吗? I couldn't find much searching on the web.我在网上找不到太多搜索。

Thanks in advance!提前致谢!

You should develop a queue for sending email because AWS SES does not offer that feature and if you want to send a lot of emails very soon, you have the problem with sending limit.您应该开发一个用于发送电子邮件的队列,因为AWS SES 不提供该功能,如果您想很快发送大量电子邮件,则会遇到发送限制问题。 So, the queue is vital in any email sender service.因此,队列在任何电子邮件发件人服务中都至关重要。

For the queue, you can use AWS SQS, for handling hard and soft bounces you can use AWS SNS and AWS lambda function to manage all of them.对于队列,您可以使用 AWS SQS,对于处理硬反弹和软反弹,您可以使用 AWS SNS 和 AWS lambda 函数来管理所有这些。

SES does not provide this natively. SES 本身不提供此功能。 What I've done is to create a queue to process the emails plus schedule them within my limits.我所做的是创建一个队列来处理电子邮件并在我的限制范围内安排它们。

Here's the psuedocode:这是伪代码:

queue = []
limitPerSecond = <Your API limit>
putEmailsInQueue(queue)

while (true) {
  processQueue(queue)
  wait 1s
}

function processQueue(queue) {
  numberOfEmailsToPop = limitPerSecond
  emailsToSend = popEmailsFromQueue(queue, numberOfEmailsToPop)
  sendEmails(emailsToSend)
}

You can also check out huhumails.com您也可以查看huhumails.com

Disclaimer: I'm the author of the service and I made it to make it easier for people to worry less about this issue.免责声明:我是该服务的作者,我这样做是为了让人们更轻松地担心这个问题。

HuhuMails acts as the middle-man between you and Amazon SES to take care of email scheduling and make sure your emails are sent within your rate limit. HuhuMails充当您和 Amazon SES 之间的中间人,负责安排电子邮件并确保您的电子邮件在您的速率限制内发送。 It also accepts date and timezone parameters if you want to send your email in the future.如果您想在将来发送电子邮件,它还接受日期和时区参数。

I'm currently using this for my other websites as well.我目前也在我的其他网站上使用它。 Hope you and other people find it useful.希望你和其他人觉得它有用。 Let me know if you have any questions.如果您有任何问题,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM