X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fdeliver%2FDeliver_IMAP.class.php;h=b559e5c60ced8b71888eb72ed4f8e247c115f977;hp=2bb90dd08da491b0e53bb983d6b0d53b07c5b9c7;hb=353d074afac6827c90f4bb03e846c5e453d3b5b1;hpb=6c99d1de81366bceab6c9d6cf12179eedc81f9bc diff --git a/class/deliver/Deliver_IMAP.class.php b/class/deliver/Deliver_IMAP.class.php index 2bb90dd0..b559e5c6 100644 --- a/class/deliver/Deliver_IMAP.class.php +++ b/class/deliver/Deliver_IMAP.class.php @@ -5,7 +5,7 @@ * * Delivery backend for the Deliver class. * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright 1999-2018 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -25,6 +25,61 @@ class Deliver_IMAP extends Deliver { return true; } + /** + * function send_mail - send the message parts to the IMAP stream + * + * Overridden from parent class so that we can insert some + * IMAP APPEND commands before and after the message is + * sent on the IMAP stream. + * + * @param Message $message Message object to send + * @param string $header Headers ready to send + * @param string $boundary Message parts boundary + * @param resource $stream Handle to the SMTP stream + * (when FALSE, nothing will be + * written to the stream; this can + * be used to determine the actual + * number of bytes that will be + * written to the stream) + * @param int &$raw_length The number of bytes written (or that + * would have been written) to the + * output stream - NOTE that this is + * passed by reference + * @param string $folder The IMAP folder to which the + * message is being sent + * + * @return void + * + */ + function send_mail($message, $header, $boundary, $stream=false, + &$raw_length, $folder=NULL) { + + if (is_null($folder)) + die('Internal error. Cannot pass NULL folder name to Deliver_IMAP::send_mail()'); + + // write the body without providing a stream so we + // can calculate the final length - after this call, + // $final_length will be our correct final length value + // + $final_length = $raw_length; + $this->writeBody($message, 0, $final_length, $boundary); + + + // now if we have a real live stream, send the message + // + if ($stream) { + sqimap_append ($stream, $folder, $final_length); + + $this->preWriteToStream($header); + $this->writeToStream($stream, $header); + $this->writeBody($message, $stream, $raw_length, $boundary); + + sqimap_append_done ($stream, $folder); + } + + } + + /* to do: finishing the imap-class so the initStream function can call the imap-class */ }