Can't send mails with mail() function |
Hello!
I was just trying to send my mails with CI3 with default mail() function, but getting an error (German) Die E-Mail konnte mit PHP mail() nicht gesendet werden. Ihr Server ist offenbar nicht konfiguriert, um mit dieser Methode E-Mails zu versenden. (Translated) The email could not be sent with with PHP mail(). Your server is apparently not configured to send e-mails using this method. Strange thing, that if i use pure mail() function without CI3, it works! I was following down the error and found in Email library. The function PHP Code: protected function _send_with_mail() As you can see, there is a check if PHP is running in safe mode, if no, use this: PHP Code: return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$this->clean_email($this->_headers['Return-Path'])); My server is running with Debian 7.8 and latest php-fpm and sendmail. Is there some solution not to touch the core library?
In pure php did you try to send an email using a fifth parameter and it worked? http://php.net/manual/en/function.mail.php
Website: http://avenir.ro
So, was trying right now. Fifth parameter is not being accepted at all by PHP 6.8 and latest sendmail from apt-get.
Some reconfiguration of them required?
So, okay. I found the problem. For anyone wh might have the same trouble, here is solution.
My server's php was configured to send mails already with the "-f" flag in php.ini. So it was: sendmail_path = /usr/sbin/sendmail -t -i -f [email protected] Just remove -f [email protected] so it will look like "sendmail_path = /usr/sbin/sendmail -t -i" and enjoy! |
Welcome Guest, Not a member yet? Register Sign In |