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)); } if (!$this->fromname) { $this->fromname = $this->from; } else { $this->fromname = trim($_isso->unsanitize($this->fromname)); } 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))); } 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->from}>\n"; $headers .= "Return-Path: {$this->from}\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->to, $this->subject, $this->body, $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("\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$ || ################################################################### \*=====================================================================*/ ?>