Re: php & qmail

From: Date: Mon, 25 Aug 2003 05:50:23 +0000
Subject: Re: php & qmail
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160640@lists.php.net to get a copy of this message
* Thus wrote Kris Reid (kris@listzapper.com): > Hi > > I'm trying to build a program using PHP to increase the performance of Qmail. > > I'm trying to use PHP to send an email qmail-remote which connects directly to the > recipients mail server. > If this fails it will then add it to the queue normally so it can retry later. > > Here is what I have so far (Note this runs on the command line) > > function sendMail($host, $to, $from, $message) { > > $prog = "/var/qmail/bin/qmail-remote $host $from $to"; > echo "Program = $prog \r\n"; > > $handle = popen ($prog, "w"); > // fwrite($handle, $message) ; > pclose($handle); > } > > The problem I have is I don't know how to write the message. > When you manually run qmail-remote $host $from $to > You then have to type the message then press control + D > Just like the standard mail function in UNIX Actually the mail function usually uses '.' on a line by iteself to terminate a message. > > How can I type "Message control + D" into the program ? the '^D' character is the end of file marker on unix. it has the ordinal value of 0x04 so you can append to your mail message something like: $mailmessage .= chr(4); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#160640) next »