PHP handling postfix mail Content _php Tutorials

Source: Internet
Author: User
 
 
  1. 01
  2. 02
  3. Geneva #从输入读取到所有的邮件内容
  4. Geneva $email = "" ;
  5. to $FD = fopen ("Php://stdin", "R");
  6. . while (! feof ($fd)) {
  7. - $email .= fread ($fd, 1024);
  8. 08}
  9. fclose ($fd);
  10. 10
  11. #记录所有的内容, test
  12. A file_put_contents ("/tmp/mail/". Time (), $email);
  13. 13
  14. #处理邮件
  15. the $lines = Explode ("", $email);
  16. 16
  17. - //Empty VARs
  18. - $from = "" ;
  19. + $date = "" ;
  20. - $subject = "" ;
  21. + $message = "" ;
  22. A $splittingheaders = true;
  23. 23
  24. - for ($i=0; $i < Count ($lines); $i ++) {
  25. - if ($splittingheaders) {
  26. 26
  27. - // Look out for special headers
  28. - if (Preg_match ("/^subject: (. *)/", $lines[$i], $ Matches)) {
  29. in $subject = $matches [1];
  30. 30}
  31. to if (Preg_match ("/^from: (. *)/", $lines[$i], $matches)) {
  32. + if (strpos($lines[$i],"<")) {
  33. - //the name exist too in from header
  34. the $data = Explode (<,$lines[$i]);
  35. * $from = substr (Trim ($data[1]), 0,-1);
  36. (+ } Else {
  37. Panax Notoginseng //only The Mail
  38. - $from = $matches [1];
  39. 39}
  40. < 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 ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.