- 01
- 02
- Geneva #从输入读取到所有的邮件内容
- Geneva $email = "" ;
- to $FD = fopen ("Php://stdin", "R");
- . while (! feof ($fd)) {
- - $email .= fread ($fd, 1024);
- 08}
- fclose ($fd);
- 10
- #记录所有的内容, test
- A file_put_contents ("/tmp/mail/". Time (), $email);
- 13
- #处理邮件
- the $lines = Explode ("", $email);
- 16
- - //Empty VARs
- - $from = "" ;
- + $date = "" ;
- - $subject = "" ;
- + $message = "" ;
- A $splittingheaders = true;
- 23
- - for ($i=0; $i < Count ($lines); $i ++) {
- - if ($splittingheaders) {
- 26
- - // Look out for special headers
- - if (Preg_match ("/^subject: (. *)/", $lines[$i], $ Matches)) {
- in $subject = $matches [1];
- 30}
- to if (Preg_match ("/^from: (. *)/", $lines[$i], $matches)) {
- + if (strpos($lines[$i],"<")) {
- - //the name exist too in from header
- the $data = Explode (<,$lines[$i]);
- * $from = substr (Trim ($data[1]), 0,-1);
- (+ } Else {
- Panax Notoginseng //only The Mail
- - $from = $matches [1];
- 39}
< p="">
http://www.bkjia.com/PHPjc/478830.html www.bkjia.com true http://www.bkjia.com/PHPjc/478830.html techarticle 01?php 02 03# read from the input to all the contents of the message $email =; $fd = fopen (Php://stdin, R); while (! feof ($FD)) {$email. = f Read ($FD, 1024); 09fclose ($fd ...
-