bug40854.phpt 1.1 KB

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