Reputation: 233
$this->load->model('emailmodel');
$query = $this->emailmodel->get_emails();
$emails = array();
set_time_limit(0);
foreach($query->result() as $u)
{
$this->notification->send($u->to, $this->config->item('neworder'),'orders/mail/subscription',
array(
'order' => $neworder,
'user' => $user
));
break;
}
so I am sending mail in a loop for each subscribed user, but it gives me an error:
Could not execute mail delivery program '/usr/sbin/sendmail -t -i '
how to fix this?
Upvotes: 6
Views: 7175
Reputation: 381
The same case of sending more than 50,000 emails (1.1GB of data) occurred here.
I used a simple script that reads everything with a "select * from email_queue" and passes it to mail() in a mysqli_fetch_assoc()-loop. This has been running smoothly with cronjob for years, but not the last times.
The solution here was to send only a "select id from email_queue", which then reads the record in the loop with another "select *..." and passes it to mail(). Besides, the average load has dropped significantly.
Upvotes: 0
Reputation: 2633
In my case the site was hosted on MediaTemple and it appeared to be the PHP version. The site was running on 5.3 FastCGI and when I switched to 5.3 CGI it worked fine.
Upvotes: 0
Reputation: 1
We also had this strange error show up all of a sudden. Restarting php-fpm cleared the issue in our case. It may have been caused my the maximum number of files, or some other memory-leak type of issue. To prevent this from happening again, I enabled pm.max_requests = 200 so that the php-fpm processes are cycled more often.
Upvotes: 0
Reputation: 21
We had the same problem. please check the security limits on your system (ulimit)
You can execute ulimit -a
bash# ulimit -a
...
open files (-n) 1024
max user processes (-u) 1024
...
You can change this on RedHat in /etc/security/limits.conf We have change the nproc and nofile to a bigger value.
Because each mail() call opens a port(file). If you reach the Filelimit this errormessage occurs.
Upvotes: 2
Reputation: 21
I think your system doesn't support sendmail in that path.. You have to change the sendmail path or reinstall it and be sure that your queue mail isnot overloaded...
Upvotes: 2