Deliver_IMAP.class.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Deliver_IMAP.class.php
  4. *
  5. * Delivery backend for the Deliver class.
  6. *
  7. * @copyright &copy; 1999-2007 The SquirrelMail Project Team
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @version $Id$
  10. * @package squirrelmail
  11. */
  12. /** This of course depends upon Deliver.. */
  13. require_once(SM_PATH . 'class/deliver/Deliver.class.php');
  14. /**
  15. * This class is incomplete and entirely undocumented.
  16. * @package squirrelmail
  17. */
  18. class Deliver_IMAP extends Deliver {
  19. function getBcc() {
  20. return true;
  21. }
  22. /**
  23. * function send_mail - send the message parts to the IMAP stream
  24. *
  25. * Overridden from parent class so that we can insert some
  26. * IMAP APPEND commands before and after the message is
  27. * sent on the IMAP stream.
  28. *
  29. * @param Message $message Message object to send
  30. * @param string $header Headers ready to send
  31. * @param string $boundary Message parts boundary
  32. * @param resource $stream Handle to the SMTP stream
  33. * (when FALSE, nothing will be
  34. * written to the stream; this can
  35. * be used to determine the actual
  36. * number of bytes that will be
  37. * written to the stream)
  38. * @param int &$raw_length The number of bytes written (or that
  39. * would have been written) to the
  40. * output stream - NOTE that this is
  41. * passed by reference
  42. * @param string $folder The IMAP folder to which the
  43. * message is being sent
  44. *
  45. * @return void
  46. *
  47. */
  48. function send_mail($message, $header, $boundary, $stream=false,
  49. &$raw_length, $folder) {
  50. // write the body without providing a stream so we
  51. // can calculate the final length - after this call,
  52. // $final_length will be our correct final length value
  53. //
  54. $final_length = $raw_length;
  55. $this->writeBody($message, 0, $final_length, $boundary);
  56. // now if we have a real live stream, send the message
  57. //
  58. if ($stream) {
  59. sqimap_append ($stream, $folder, $final_length);
  60. $this->preWriteToStream($header);
  61. $this->writeToStream($stream, $header);
  62. $this->writeBody($message, $stream, $raw_length, $boundary);
  63. sqimap_append_done ($stream, $folder);
  64. }
  65. }
  66. /* to do: finishing the imap-class so the initStream function can call the
  67. imap-class */
  68. }