ce53a05a04f2d24c6dccd3ad4b924e30ba123512
4 * Deliver_IMAP.class.php
6 * Delivery backend for the Deliver class.
8 * @copyright © 1999-2009 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @package squirrelmail
14 /** This of course depends upon Deliver.. */
16 require_once(SM_PATH
. 'class/deliver/Deliver.class.php');
19 * This class is incomplete and entirely undocumented.
20 * @package squirrelmail
22 class Deliver_IMAP
extends Deliver
{
29 * function send_mail - send the message parts to the IMAP stream
31 * Overridden from parent class so that we can insert some
32 * IMAP APPEND commands before and after the message is
33 * sent on the IMAP stream.
35 * @param Message $message Message object to send
36 * @param string $header Headers ready to send
37 * @param string $boundary Message parts boundary
38 * @param resource $stream Handle to the SMTP stream
39 * (when FALSE, nothing will be
40 * written to the stream; this can
41 * be used to determine the actual
42 * number of bytes that will be
43 * written to the stream)
44 * @param int &$raw_length The number of bytes written (or that
45 * would have been written) to the
46 * output stream - NOTE that this is
48 * @param string $folder The IMAP folder to which the
49 * message is being sent
54 function send_mail($message, $header, $boundary, $stream=false,
55 &$raw_length, $folder) {
57 // write the body without providing a stream so we
58 // can calculate the final length - after this call,
59 // $final_length will be our correct final length value
61 $final_length = $raw_length;
62 $this->writeBody($message, 0, $final_length, $boundary);
65 // now if we have a real live stream, send the message
68 sqimap_append ($stream, $folder, $final_length);
70 $this->preWriteToStream($header);
71 $this->writeToStream($stream, $header);
72 $this->writeBody($message, $stream, $raw_length, $boundary);
74 sqimap_append_done ($stream, $folder);
80 /* to do: finishing the imap-class so the initStream function can call the