1--TEST-- 2Test imap_append() function : basic functionality 3--EXTENSIONS-- 4imap 5--SKIPIF-- 6<?php 7require_once(__DIR__. '/setup/skipif.inc'); 8?> 9--FILE-- 10<?php 11echo "*** Testing imap_append() : basic functionality ***\n"; 12 13require_once(__DIR__. '/setup/imap_include.inc'); 14 15echo "Create a new mailbox for test\n"; 16$imap_stream = setup_test_mailbox("imapappendbaisc", 0); 17 18$mb_details = imap_mailboxmsginfo($imap_stream); 19echo "Add a couple of msgs to the new mailbox\n"; 20var_dump(imap_append($imap_stream, $mb_details->Mailbox 21 , "From: webmaster@example.com\r\n" 22 . "To: info@example.com\r\n" 23 . "Subject: Test message\r\n" 24 . "\r\n" 25 . "this is a test message, please ignore\r\n" 26 )); 27 28var_dump(imap_append($imap_stream, $mb_details->Mailbox 29 , "From: webmaster@example.com\r\n" 30 . "To: info@example.com\r\n" 31 . "Subject: Another test\r\n" 32 . "\r\n" 33 . "this is another test message, please ignore it too!!\r\n" 34 )); 35 36$check = imap_check($imap_stream); 37echo "Msg Count after append : ". $check->Nmsgs . "\n"; 38 39echo "List the msg headers\n"; 40var_dump(imap_headers($imap_stream)); 41 42imap_close($imap_stream); 43?> 44--CLEAN-- 45<?php 46$mailbox_suffix = 'imapappendbaisc'; 47require_once(__DIR__ . '/setup/clean.inc'); 48?> 49--EXPECTF-- 50*** Testing imap_append() : basic functionality *** 51Create a new mailbox for test 52Create a temporary mailbox and add 0 msgs 53New mailbox created 54Add a couple of msgs to the new mailbox 55bool(true) 56bool(true) 57Msg Count after append : 2 58List the msg headers 59array(2) { 60 [0]=> 61 string(%d) "%w%s 1)%s webmaster@example.co Test message (%d chars)" 62 [1]=> 63 string(%d) "%w%s 2)%s webmaster@example.co Another test (%d chars)" 64} 65