bug40854.phpt 1.2 KB

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