Unable to send email using PHP mail() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Unable to send email using PHP mail() (/showthread.php?tid=31487) |
Unable to send email using PHP mail() - El Forum - 06-21-2010 [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? Unable to send email using PHP mail() - El Forum - 06-21-2010 [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. Unable to send email using PHP mail() - El Forum - 06-21-2010 [eluser]danmontgomery[/eluser] We can't read minds... You'll need to post some code. Unable to send email using PHP mail() - El Forum - 06-21-2010 [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? |