CodeIgniter Forums

Full Version: Unable to send email using PHP mail()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]silverback[/eluser]
Hi,

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?

El Forum

[eluser]silverback[/eluser]
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.

El Forum

[eluser]danmontgomery[/eluser]
We can't read minds... You'll need to post some code.

El Forum

[eluser]silverback[/eluser]
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?