1--TEST-- 2Test imap_fetch_overview() function : usage variations - multipart message 3--SKIPIF-- 4<?php 5require_once(__DIR__.'/setup/skipif.inc'); 6?> 7--FILE-- 8<?php 9/* 10 * Pass a multipart message to imap_fetch_overview() to test the contents of returned array 11 */ 12 13echo "*** Testing imap_fetch_overview() : usage variations ***\n"; 14 15require_once __DIR__.'/setup/imap_include.inc'; 16 17$stream_id = setup_test_mailbox('imapfetchoverviewvar6', 0, $mailbox); // setup temp mailbox 18create_multipart_message($stream_id, $mailbox); 19 20// refresh msg numbers 21imap_check($stream_id); 22$msg_no = 1; 23 24$a = imap_fetch_overview($stream_id, $msg_no); 25echo "\n--> Object #1\n"; 26displayOverviewFields($a[0]); 27 28 29 30 31/** 32 * Create a multipart message with subparts 33 * 34 * @param resource $imap_stream 35 * @param string $mailbox 36 */ 37function create_multipart_message($imap_stream, $mailbox) { 38 global $users, $domain; 39 $envelope["from"]= "foo@anywhere.com"; 40 $envelope["to"] = IMAP_USERS[0] . '@' . IMAP_MAIL_DOMAIN; 41 $envelope["subject"] = "Test msg 1"; 42 43 $part1["type"] = TYPEMULTIPART; 44 $part1["subtype"] = "mixed"; 45 46 $part2["type"] = TYPETEXT; 47 $part2["subtype"] = "plain"; 48 $part2["description"] = "imap_mail_compose() function"; 49 $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; 50 51 $part3["type"] = TYPETEXT; 52 $part3["subtype"] = "plain"; 53 $part3["description"] = "Example"; 54 $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; 55 56 $file_handle = fopen(__FILE__, 'r+'); 57 $file_size = 1; 58 59 $part4["type"] = TYPEAPPLICATION; 60 $part4["encoding"] = ENCBASE64; 61 $part4["subtype"] = "octet-stream"; 62 $part4["description"] = 'Test'; 63 $part4['disposition.type'] = 'attachment'; 64 $part4['disposition'] = array ('filename' => 'Test'); 65 $part4['type.parameters'] = array('name' => 'Test'); 66 $part4["contents.data"] = base64_encode(fread($file_handle, 1)); 67 68 $body[1] = $part1; 69 $body[2] = $part2; 70 $body[3] = $part3; 71 $body[4] = $part4; 72 73 $msg = imap_mail_compose($envelope, $body); 74 75 if (imap_append($imap_stream, $mailbox, $msg) === false) { 76 echo imap_last_error() . "\n"; 77 echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n"; 78 exit; 79 } 80} 81 82?> 83--CLEAN-- 84<?php 85$mailbox_suffix = 'imapfetchoverviewvar6'; 86require_once(__DIR__.'/setup/clean.inc'); 87?> 88--EXPECTF-- 89*** Testing imap_fetch_overview() : usage variations *** 90Create a temporary mailbox and add 0 msgs 91New mailbox created 92 93--> Object #1 94size is %d 95uid is %d 96msgno is 1 97recent is %d 98flagged is 0 99answered is 0 100deleted is 0 101seen is 0 102draft is 0 103udate is OK 104