K
K
Kirill Gorelov2015-10-28 22:53:10
PHP
Kirill Gorelov, 2015-10-28 22:53:10

Restrictions on sending emails in php?

Hello.
There is a code for sending an email from php.

<?php
  $to = "[email protected]";
  $subject = "Robot - Робот";
  $message = "Message, сообщение!";
  mail ($to, $subject, $message);
?>

All clear. Everything is fine.
Now let's say I have 1000 emails. How to limit sending by time. For example. Send only 100 emails per hour, next 100 emails the next hour, and so on!
There, as I understand it, there must be a cycle ???
And if so, how to implement it, how to set conditions for its restriction?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Optimus, 2015-10-28
@Kirill-Gorelov

Cron every minute. For 1 cron run 20 letters. Total 1200 emails per hour. But your letters will end up in spam, you need someone else's smtp, for example, Yandex or Google, and there are daily limits. Then your mail server will have to be thoroughly configured.

M
m0rd, 2015-10-28
@m0rd

1. We put 1000 letters in the queue.
2. Once an hour, we run the sending script, which sends 100 letters, by cron.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question