home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / .tmp007.phpt < prev    next >
Encoding:
Text File  |  2004-03-24  |  1.2 KB  |  47 lines

  1. --TEST--
  2. Check RFC822 Conformance
  3. --SKIPIF--
  4. <?php 
  5. /* vim600: sw=4 ts=4 fdm=marker syn=php
  6. */
  7. if (!extension_loaded("mailparse")) @dl("mailparse.so");
  8. if (!extension_loaded("mailparse")) print "skip"; ?>
  9. --POST--
  10. --GET--
  11. --FILE--
  12. <?php
  13. if (!extension_loaded("mailparse")) @dl("mailparse.so");
  14. $addresses = array(
  15.     "\":sysmail\"@ Some-Group. Some-Org, Muhammed.(I am the greatest) Ali @(the)Vegas.WBA",
  16.     "\"strange\":\":sysmail\"@ Some-Group. Some-Org, Muhammed.(I am the greatest) Ali @(the)Vegas.WBA;"
  17. );
  18.  
  19. foreach($addresses as $address) {
  20.     $parsed = mailparse_rfc822_parse_addresses($address);
  21.     foreach($parsed as $pair) {
  22.         print $pair["display"] . "\n";
  23.         print $pair["address"] . "\n";
  24.         if ($pair["is_group"]) {
  25.             $sub = mailparse_rfc822_parse_addresses(substr($pair["address"], 1, strlen($pair["address"]) - 2));
  26.             foreach($sub as $subpair) {
  27.                 print "   " . $subpair["address"] . "\n";
  28.             }
  29.         }
  30.     }
  31.     print "...\n";
  32. }
  33.  
  34. ?>
  35. --EXPECT--
  36. :sysmail@Some-Group.Some-Org
  37. ":sysmail"@Some-Group.Some-Org
  38. I am the greatest the
  39. Muhammed.Ali@Vegas.WBA
  40. ...
  41. strange
  42. :":sysmail"@Some-Group.Some-Org,Muhammed.Ali@Vegas.WBA;
  43.    ":sysmail"@Some-Group.Some-Org
  44.    Muhammed.Ali@Vegas.WBA
  45. ...
  46.  
  47.