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