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