2 Test imap_append() function : basic functionality
5 require_once(dirname(__FILE__).'/skipif.inc');
9 /* Prototype : bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options ] )
10 * Description: Append a string message to a specified mailbox.
11 * Source code: ext/imap/php_imap.c
14 echo "*** Testing imap_append() : basic functionality ***\n";
16 require_once(dirname(__FILE__).'/imap_include.inc');
18 echo "Create a new mailbox for test\n";
19 $imap_stream = setup_test_mailbox("", 0);
20 if (!is_resource($imap_stream)) {
21 exit("TEST FAILED: Unable to create test mailbox\n");
24 $mb_details = imap_mailboxmsginfo($imap_stream);
25 echo "Add a couple of msgs to new mailbox " . $mb_details->Mailbox . "\n";
26 var_dump(imap_append($imap_stream, $mb_details->Mailbox
27 , "From: webmaster@something.com\r\n"
28 . "To: info@something.com\r\n"
29 . "Subject: Test message\r\n"
31 . "this is a test message, please ignore\r\n"
34 var_dump(imap_append($imap_stream, $mb_details->Mailbox
35 , "From: webmaster@something.com\r\n"
36 . "To: info@something.com\r\n"
37 . "Subject: Another test\r\n"
39 . "this is another test message, please ignore it too!!\r\n"
42 $check = imap_check($imap_stream);
43 echo "Msg Count after append : ". $check->Nmsgs . "\n";
45 echo "List the msg headers\n";
46 var_dump(imap_headers($imap_stream));
48 imap_close($imap_stream);
53 require_once('clean.inc');
56 *** Testing imap_append() : basic functionality ***
57 Create a new mailbox for test
58 Create a temporary mailbox and add 0 msgs
59 .. mailbox '%s' created
60 Add a couple of msgs to new mailbox {%s}INBOX.%s
63 Msg Count after append : 2
67 string(%d) "%w%s 1)%s webmaster@something. Test message (%d chars)"
69 string(%d) "%w%s 2)%s webmaster@something. Another test (%d chars)"