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