rfc822_header; $from = $rfc822_header->from[0]; $envelopefrom = trim($from->mailbox.'@'.$from->host); $envelopefrom = str_replace(array("\0","\n"),array('',''),$envelopefrom); if (strstr($sendmail_path, "qmail-inject")) { $stream = popen (escapeshellcmd("$sendmail_path -i -f$envelopefrom"), "w"); } else { $stream = popen (escapeshellcmd("$sendmail_path -i -t -f$envelopefrom"), "w"); } return $stream; } /** * function finalizeStream * * Close the stream. * * @param resource $stream * @return boolean * @access public */ function finalizeStream($stream) { pclose($stream); return true; } /** * function getBcc * * In case of sendmail, the rfc822header must contain the bcc header. * * @return boolean true if rfc822header should include the bcc header. * @access private */ function getBcc() { return true; } /** * function clean_crlf * * Cleans each line to only end in a LF * Returns the length of the line including a CR, * so that length is correct when the message is saved to imap * Implemented to fix sendmail->postfix rejection of messages with * attachments because of stray LF's * * @param string $s string to strip of CR's * @return integer length of string including a CR for each LF * @access private */ function clean_crlf(&$s) { $s = str_replace("\r\n", "\n", $s); $s = str_replace("\r", "\n", $s); $s2 = str_replace("\n", "\r\n", $s); return strlen($s2); } } ?>