debug("email: no sendmail -> not sending"); return false; } $this->toemail = $this->_fetch_first_line($this->toemail); $this->fromemail = $this->_fetch_first_line($this->fromemail); if (!$this->fromemail) { $_isso->debug("email: no from -> not sending"); return false; } else { $this->fromemail = trim($_isso->unsanitize($this->fromemail)); } if (!$this->fromname) { $this->fromname = $this->fromemail; } else { $this->fromname = trim($_isso->unsanitize($this->fromname)); } if (!$this->toemail) { $_isso->debug("email: no recipient -> not sending"); return false; } else { $this->toemail = trim($_isso->unsanitize($this->toemail)); } if (!$this->subject) { $_isso->debug("email: no subject -> not sending"); return false; } else { $this->subject = trim($_isso->unsanitize($this->_fetch_first_line($subject))); } if (!$this->body) { $_isso->debug("email: no body -> not sending"); return false; } else { $this->body = $this->_convert_line_breaks($this->body); $this->body = trim($_isso->unsanitize($this->body)); } $headers = $this->_convert_line_breaks($this->headers, "\n"); $headers .= "From \"{$this->fromname}\" <{$this->fromemail}>\n"; $headers .= "Return-Path: {$this->fromemail}\n"; $headers .= "X-Mailer: ISSO Mail Framework \$Revision$\n"; $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: 7bit\n"; $headers = trim($headers); if (mail($this->toemail, $this->subject, $this->body, $headers, "-f {$this->fromemail}")) { $_isso->debug("email: sent -> good"); return true; } else { $_isso->debug("email: sent -> error"); return false; } } /** * Fetches the first line of a string * * @param str A string * * @return str The first line of the string */ function _fetch_first_line($string) { $string = $this->_convert_line_breaks($string); $broken = explode("\r\n", $string); return $broken[0]; } /** * Changes line breaks into one format * * @param str Text * @param str New line break (default is Windows DOS format) * * @return str Text with one type of line break */ function _convert_line_breaks($text, $convert_to = "\r\n") { return preg_replace("#(\r|\n|\r\n)#s", $convert_to, trim($text)); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>