Welcome Guest, Not a member yet? Register   Sign In
Can't send mails with mail() function
#1

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()
 {
 if (
is_array($this->_recipients))
 {
 
$this->_recipients implode(', '$this->_recipients);
 }

 if (
$this->_safe_mode === TRUE)
 {
 return 
mail($this->_recipients$this->_subject$this->_finalbody$this->_header_str);
 }
 else
 {
 
// most documentation of sendmail using the "-f" flag lacks a space after it, however
 // we've encountered servers that seem to require it to be in place.
 
return mail($this->_recipients$this->_subject$this->_finalbody$this->_header_str'-f '.$this->clean_email($this->_headers['Return-Path']));
 }
 } 

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'])); 
And that doesn't work! The fifth parameter is one which breaks sending mails. If i remove it, it works.

My server is running with Debian 7.8 and latest php-fpm and sendmail. Is there some solution not to touch the core library?
Reply


Messages In This Thread
Can't send mails with mail() function - by V I R U S - 04-26-2015, 02:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB