* Thus wrote Kris Reid ([EMAIL PROTECTED]): > 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." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php