debug("email: no sendmail -> not sending"); return false; } $this->to = $this->_fetch_first_line($this->to); $this->from = $this->_fetch_first_line($this->from); if (!$this->from) { $_isso->debug("email: no from -> not sending"); return false; } else { $this->from = trim($_isso->unsanitize($this->from, true)); } if (!$this->fromname) { $this->fromname = $this->from; } else { $this->fromname = trim($_isso->unsanitize($this->fromname, true)); } if (!$this->to) { $_isso->debug("email: no recipient -> not sending"); return false; } else { $this->to = trim($_isso->unsanitize($this->to)); } if (!$this->subject) { $_isso->debug("email: no subject -> not sending"); return false; } else { $this->subject = trim($_isso->unsanitize($this->_fetch_first_line($this->subject), true)); } 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, true)); } $this->headers = $this->_convert_line_breaks($this->headers); $this->headers .= "From: \"{$this->fromname}\" <{$this->from}>\n"; $this->headers .= "Return-Path: {$this->from}\n"; $this->headers .= "X-Mailer: ISSO Mail Framework \$Revision$\n"; $this->headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $this->headers .= "Content-Transfer-Encoding: 7bit\n"; if (mail($this->to, $this->subject, $this->body, trim($this->headers), "-f {$this->from}")) { $_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("\n", $string); return $broken[0]; } /** * Changes line breaks into one format * * @param str Text * @param str New line break (default is UNIX format) * * @return str Text with one type of line break */ function _convert_line_breaks($text, $convert_to = "\n") { $text = trim($text); $text = str_replace(array("\r\n", "\r", "\n"), "\n", $text); $text = str_replace("\n", $convert_to, $text); return $text; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>