This topic is locked
[SOLVED]

Send bulk mail

4/5/2022 9:40:48 AM
PHPRunner General questions
J
Jan author

Hello everyone,
I have two tables: "Emails sent" and "member table"
I've added the following (working) code to the "after add record" event for the "emails" table
I have the member table down to only two members to be able to make a test and that works well.
But the table actually consists of more than 5000 members... So more than 5000 emails will have to be sent to all members Of course I can't test this, it should work immediately. Does anyone have experience with it? Is the code correct?

global $dal;
$rs = DB::Query("select name, email from members order by name')");
while ($data = db_fetch_array($rs))
{
$email=$data["email"];
$from="test@test.com";
$msg="text here";
$subject="titel";
$ret=runner_mail(array('to' => $email, 'subject' => $subject,
'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"]."
";
}
K
kohle 4/5/2022

Hi,

if the question is runner_mail can send 5000 emails. I think yes. I dont send 5000 but it works in my case with less emails.
But you must check your email smtp provider if this is possible to send 5000 emails in a short period of time.

For ex. google as smtp provider:
How do I send more than 2000 emails in Gmail?
There are two ways to increase your Gmail sending limit, and one way to create an exception:
Multiple accounts. Establish more than one authorized Gmail or Google Workspace account, each with its own limit. ...
Mass Email Service. ...
Google Groups.

The problem is what your provider allows.

rgs
J.

J
Jan author 4/5/2022

Thank you for the reply. I'll contact my provider, but I'm going to make an adjustment to send the bulk mail in packets (eg 40 emails per packet), so I want to build in the code for a while (eg 40 emails every 5 seconds).
Do you have any idea what code I can use ?

Admin 4/5/2022

You need to use a specialized email sending service for this purpose. Gmail won't let you send more than 500 emails a day and other email providers too.

If you found an email provider that allows sending bulk emails you need to build a system to send bulk emails properly. This is not a code question but more like infrastructre question. You will need to store all emails before they sent in a separate table, send emails in batches and mark those emails that were sent already. If you don't know how to build a proper system like this you need to hire someone who does.

J
Jan author 4/5/2022

Thanks for the info, I'm going to use the mailchimp api