R
R
Rollex2020-03-24 09:55:54
PHP
Rollex, 2020-03-24 09:55:54

How to limit 100 emails per hour via php?

Most mail services such as Mailgun have a limit on sending emails (100 emails per hour).
There is a user base and there is a need to do a newsletter.
What is the best and most correct way to implement metered mailing? Do mailing queues through cron and database? Or are there other options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2020-03-24
@Rollex

It can be so. And you can set up a local postfix with sending limits
https://wiki.deimos.fr/Postfix:_limit_outgoing_mai...

V
Vladimir, 2020-03-24
@MechanID

Most of the ratelimits usually work through the database -
when sending, the number of those sent in the last hour is checked, if there is no excess, we send and increment the number, if the current hour != hour in the database, reset the counter and write it down.
you also need to decide what to do if the limit is exceeded (do not send at all, put in a queue and what to do if the queue is growing all the time)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question