Failed to execute mail delivery program

$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 send mail in a loop for each subscribed user, but this gives me an error:

 Could not execute mail delivery program '/usr/sbin/sendmail -t -i ' 

How to fix it?

+4
source share
5 answers

I think your system does not support sendmail in this way. You need to change the sendmail path or reinstall it and make sure your mail is not overloaded ...

+2
source

We had the same problem. check the security limits of your system (ulimit)

You can execute ulimit -a

bash # ulimit -a

...
open files (-n) 1024
Maximum User Processes (-u) 1024
...

You can change this to RedHat in /etc/security/limits.conf We changed the value of nproc and nofile to a larger value.

Since each call to mail () opens a port (file). If you have reached Filelimit, this error occurs.

+1
source

We also unexpectedly discovered this strange error. Restarting php-fpm cleared the problem in our case. Perhaps this caused my maximum number of files or some other type of memory leak problem. To prevent this from happening again, I turned on pm.max_requests = 200 so that php-fpm processes repeat more often.

0
source

In my case, the site was hosted on MediaTemple, and it turned out to be a version of PHP. The site worked on 5.3 FastCGI, and when I switched to 5.3 CGI, it worked fine.

0
source

Here the same case occurred sending more than 50,000 letters (1.1 GB of data).

I used a simple script that reads everything using "select * from email_queue" and passes it to mail () in the mysqli_fetch_assoc () loop. It has been running smoothly cronjob for years, but not for the last time.

The solution here was to send only "select id from email_queue", which then reads the record in a loop using another "select * ..." and passes it to mail (). In addition, the average load decreased significantly.

0
source

All Articles