日期:2012-02-18 浏览次数:20477 次
- 01 <?php
- 02
- 03 #从输入读取到所有的邮件内容
- 04 $email = "";
- 05 $fd = fopen("php://stdin", "r");
- 06 while (!feof($fd)) {
- 07 $email .= fread($fd, 1024);
- 08 }
- 09 fclose($fd);
- 10
- 11 #记录所有的内容,测试
- 12 file_put_contents("/tmp/mail/".time(), $email);
- 13
- 14 #处理邮件
- 15 $lines = explode("\n", $email);
- 16
- 17 // empty vars
- 18 $from = "";
- 19 $date = "";
- 20 $subject = "";
- 21 $message = "";
- 22 $splittingheaders = true;
- 23
- 24 for ($i=0;