• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to send email using PHP mail()


I'm using CI's email class to send mail. When I move my site to my web host, I get the error message you see in the title.

The thing is that when I make a script and use the mail() function manually, it works perfectly. So why doesn't it work with CI?

I've narrowed down the problem to this line in Email.php:
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From'])))

Namely the "-f ".$this->clean_email($this->_headers['From']) seems to break it.

We can't read minds... You'll need to post some code.

I fixed it:
$this->_headers[‘From’] contained an invalid email address (namely an empty string) which caused it to get rejected. Perhaps CI can do some checked on this in later versions?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.