如何设置电子邮件发送速度限制?

I have a forum on discourse but with slow sending speed limit (20/sec)
Am I able to set sending speed limit on discourse?

I’m asking this because I found that I got nearly 500,000 records everyday on unsubscribe_keys table, but only 9000 in mail_log and 1000 in skipped_mail_log, our forum have nearly 500,000 members, too.
I’m not sure whether it’s caused by sending email too fast and make some weird problem happened, so I’m trying to throttle the sending speed but with no luck.

Unsubscribe_keys

email_log

2 个赞

You need to get a faster mail server and/or change settings so that let mail gets sent.

You can change how often summary emails get sent and change the max emails per day setting.

There is no rate limit setting.

1 个赞

not sure whether sending rate is necessary…
because even we can increase to probably 60/sec,it’s still possible that the server send too fast and get blocked.

2 个赞

What are you using to send email?

I use AWS SES service

1 个赞

Have you raised with their support?

1 个赞

Why are so many Discourse members being mailed? What are they being mailed for, exactly? That’s the more relevant question.

On a typical Discourse install, the only “all users” email is the digest, and even that is specific to only users who have not been on the website in a week or more, but also haven’t been gone more than a year.

In general you only get emails when someone is speaking directly to you, and even then only when you haven’t touched the website with any web browser in the last 10 minutes.

8 个赞

We had an activity before. (about several months ago) That activity attracted about 90 thousand members registered. And now they may leave for a few weeks. So system sent them the digest emails

2 个赞

你找到解决方案了吗?我正准备切换到 Amazon SES,刚意识到我们的初始限制是每秒 14 封邮件。我不确定 Discourse 向 SES 发送邮件的速度会有多快。该网站发送的邮件量很大。

有人知道 Discourse 发送邮件的最大速率吗?它会尝试每秒发送超过 14 封邮件吗?

如果发送速度过快,我在想是否最好编写一个脚本,将用户的摘要发送时间在一周内均匀分布,而不是集中在一天(我们的导入纪念日)发送大部分邮件。

编辑: 我意识到可以通过查看 Mandrill 日志来确认这是否是个问题。除非 Mandrill 对我有额外的限流,否则我认为我们最多每秒能发送约 8 封邮件,所以应该没问题。

2 个赞

嘿,Josh!

对于摘要邮件,你可以通过将以下 Discourse 全局变量设置为 420,将其限制为每秒 14 封,具体方法是在你的容器构建文件中添加:

DISCOURSE_MAX_DIGESTS_ENQUEUED_PER_30_MINS_PER_SITE: 420

这并不“完全”符合你的需求,但已经非常接近了。

因为每秒 14 封(根据你的帖子)乘以 30 秒等于 420,所以这个全局设置会将摘要邮件限制为每 30 分钟大约 420 封,正如代码“所说”的那样:

另请参阅:

当然,如果你的 SMTP 通道还在发送其他邮件,你需要相应调低这个值;或者你可以为摘要邮件设置一个独立的通道(就像我们做的那样)。

注意:这个全局设置默认是每 30 分钟 10,000 封;如果问我,那意味着每小时会有大量的摘要邮件。因此,我们将这个值设得低得多,这样每月的 SendGrid 账单会更“合理”。

每 30 分钟 30 封摘要邮件 = 每天 1440 封,或每月约 43,200 封(因为在我几天前做出这个更改之前,我们发送了大量的摘要邮件)。下个月,我会将这个值提高到每 30 分钟约 60 封摘要邮件,即每月约 86,400 封左右。

希望这能帮到你。

3 个赞