1--TEST-- 2imap_rfc822_parse_headers() function : basic functionality 3--CREDITS-- 4Olivier Doucet 5--EXTENSIONS-- 6imap 7--SKIPIF-- 8<?php 9require_once(__DIR__.'/setup/skipif.inc'); 10?> 11--FILE-- 12<?php 13 14require_once(__DIR__.'/setup/imap_include.inc'); 15$stream_id = setup_test_mailbox('imaprfc822parseheadersbasic', 1); 16 17$z = imap_headerinfo($stream_id, 1); 18 19$fields = array ('toaddress','to','fromaddress','from', 20'reply_toaddress','reply_to', 21 'senderaddress', 'sender', 22'subject','Subject', 23 'MailDate','Size','udate'); 24 25 26echo "Check general fields\n"; 27foreach ($fields as $key) { 28 var_dump(isset($z->$key)); 29} 30 31echo "Check type\n"; 32var_dump($z->toaddress); 33var_dump($z->fromaddress); 34var_dump($z->reply_toaddress); 35var_dump($z->senderaddress); 36var_dump($z->subject); 37var_dump($z->Subject); 38 39if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { 40 echo "Recent: OK"; 41} else { 42 echo "Recent: error"; 43} 44echo "\n"; 45 46if ($z->Unseen == 'U' || $z->Unseen == ' ') { 47 echo "Unseen: OK"; 48} else { 49 echo "Unseen: error"; 50} 51echo "\n"; 52 53if ($z->Flagged == 'F' || $z->Flagged == ' ') { 54 echo "Flagged: OK"; 55} else { 56 echo "Flagged: error"; 57} 58echo "\n"; 59 60if ($z->Answered == 'A' || $z->Answered == ' ') { 61 echo "Answered: OK"; 62} else { 63 echo "Answered: error"; 64} 65echo "\n"; 66 67if ($z->Deleted == 'D' || $z->Deleted == ' ') { 68 echo "Deleted: OK"; 69} else { 70 echo "Deleted: error"; 71} 72echo "\n"; 73 74if ($z->Draft == 'X' || $z->Draft == ' ') { 75 echo "Draft: OK"; 76} else { 77 echo "Draft: error"; 78} 79echo "\n"; 80 81var_dump($z->Msgno); 82var_dump($z->Size); 83var_dump($z->udate); 84 85imap_close($stream_id); 86 87?> 88--CLEAN-- 89<?php 90$mailbox_suffix = 'imaprfc822parseheadersbasic'; 91require_once(__DIR__ . '/setup/clean.inc'); 92?> 93--EXPECTF-- 94Create a temporary mailbox and add 1 msgs 95New mailbox created 96Check general fields 97bool(true) 98bool(true) 99bool(true) 100bool(true) 101bool(true) 102bool(true) 103bool(true) 104bool(true) 105bool(true) 106bool(true) 107bool(true) 108bool(true) 109bool(true) 110Check type 111string(%d) "%s" 112string(%d) "%s" 113string(%d) "%s" 114string(%d) "%s" 115string(%d) "%s" 116string(%d) "%s" 117Recent: OK 118Unseen: OK 119Flagged: OK 120Answered: OK 121Deleted: OK 122Draft: OK 123string(%d) "%s" 124string(%d) "%d" 125int(%d) 126