xref: /PHP-5.6/ext/imap/tests/bug31142_1.phpt (revision 4bef3dde)
1--TEST--
2Bug #31142 test #1 (imap_mail_compose() generates incorrect output)
3--SKIPIF--
4<?php
5        if (!extension_loaded("imap")) {
6                die("skip imap extension not available");
7        }
8?>
9--FILE--
10<?php
11
12$envelope["from"]= "joe@example.com";
13$envelope["to"]  = "foo@example.com";
14$envelope["cc"]  = "bar@example.com";
15
16$part1["type"] = TYPEMULTIPART;
17$part1["subtype"] = "mixed";
18
19$part2["type"] = TYPEAPPLICATION;
20$part2["encoding"] = ENCBINARY;
21$part2["subtype"] = "octet-stream";
22$part2["description"] = "some file";
23$part2["contents.data"] = "ABC";
24
25$part3["type"] = TYPETEXT;
26$part3["subtype"] = "plain";
27$part3["description"] = "description3";
28$part3["contents.data"] = "contents.data3\n\n\n\t";
29
30$body[1] = $part1;
31$body[2] = $part2;
32$body[3] = $part3;
33
34echo imap_mail_compose($envelope, $body);
35
36?>
37--EXPECTF--
38From: joe@example.com
39To: foo@example.com
40cc: bar@example.com
41MIME-Version: 1.0
42Content-Type: MULTIPART/mixed; BOUNDARY="%s"
43
44--%s
45Content-Type: APPLICATION/octet-stream
46Content-Transfer-Encoding: BASE64
47Content-Description: some file
48
49QUJD
50
51--%s
52Content-Type: TEXT/plain; CHARSET=US-ASCII
53Content-Description: description3
54
55contents.data3
56
57
58
59--%s--
60