Sending emails to 50k users

Sending emails to 50k users

by Farhan Karmali -
Number of replies: 2
Picture of Core developers Picture of Plugin developers Picture of Testers

In my custom script I need to send emails to above 50k users 


So I just did a for loop and use the function email_to_user to send these emails. It seems it sends only about 5000 emails.


Is there something I can do about it? Do I have to use the cron compulsorily for such a situation ? Any pointers are much appreciated

Average of ratings: -
In reply to Farhan Karmali

Re: Sending emails to 50k users

by Chris Wharton -

Hi Farhan. For such a high number of users, I'd recommend using a cron script.

Looping the email_to_user function should work ok, for any number of users. The Moodle forum cron code does this.

Maybe there is an issue with the mail server?

Average of ratings: Useful (1)
In reply to Chris Wharton

Re: Sending emails to 50k users

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Thank you for your reply Chris.


When we send the emails using the sitenews forum , with forced subscription all 50k users get the email. I guess because the forums use the cron and my script does not..


My co developer really doesnt like me using the cron (rather abusing cron) .. But I guess I ll have to save soemwhere in the database how many emails are sent and resume sending from there in the cron or how does it work?