/    Sign up×
Community /Pin to ProfileBookmark

Mail loop dying early

Hi there,

I have a loop run from a mysql database that sends out about 30k emails. The problem is that the loop cuts out early so I only get about 100 emails out. I tried searching the web for similar problems and found out that the mail() function shouldn’t be used for large volumes of emails. So I tried to use phpmailer but I still have the same problem. Any ideas whats causing it? I can include the code I’m using if that will be any help.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 09.2007 — You want to use something like the [url=http://pear.php.net/package/Mail_Queue]PEAR Mail_Queue[/url] package that will put the mail requests into a queue to be run as a background process.

PS: For a ready-made mass-mailing program with a web-based interface, you might want to look at [url=http://pommo.org/Main_Page]poMMo[/url].
Copy linkTweet thisAlerts:
@NightShift58Oct 09.2007 — For a quick fix, try putting these two at the top of your script:
[code=php]
<?php
set_time_limit(0);
ignore_user_abort(true);
?>
[/code]

It'll prevent your script from timing out at whatever number of seconds your server has been set to time out.
Copy linkTweet thisAlerts:
@WebnerdOct 09.2007 — You may also be hitting a memory limit for the script on the server.

http://us2.php.net/manual/en/ini.core.php#ini.memory-limit

Can you run "top" and watch the status of the script as it is processing?

It also may be a better solution to write a temp file with those emails and use a scheduling or crontab manager to have the script execute on the server instead of through HTTP.
Copy linkTweet thisAlerts:
@bejitto101authorOct 11.2007 — Well, I was running it on a cron job, but then the server crashed and I can't get the crontab to work. Which leads me to this question: I was looking throught the mail_queue thing from pear, but that requires a cron job or something similar to run every so often so it can send out email in batches. Is there anyway to do it without a cron job? If not, would it be possible to get some cron help? Also, what do you mean by running "top"?
×

Success!

Help @bejitto101 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...