Fix E_STRICT notices
[squirrelmail.git] / class / deliver / Deliver_IMAP.class.php
CommitLineData
e1ee60fe 1<?php
4b4abf93 2
5b8fd093 3/**
4 * Deliver_IMAP.class.php
5 *
5b8fd093 6 * Delivery backend for the Deliver class.
7 *
c0d96801 8 * @copyright 1999-2012 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
883d9cd3 10 * @version $Id$
2b646597 11 * @package squirrelmail
5b8fd093 12 */
13
2b646597 14/** This of course depends upon Deliver.. */
15
0f85ddf9 16require_once(SM_PATH . 'class/deliver/Deliver.class.php');
e1ee60fe 17
2b646597 18/**
19 * This class is incomplete and entirely undocumented.
20 * @package squirrelmail
21 */
e1ee60fe 22class Deliver_IMAP extends Deliver {
23
d39ae420 24 function getBcc() {
25 return true;
26 }
91e0dccc 27
e2ccf284 28 /**
29 * function send_mail - send the message parts to the IMAP stream
30 *
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.
34 *
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
47 * passed by reference
48 * @param string $folder The IMAP folder to which the
49 * message is being sent
50 *
51 * @return void
52 *
53 */
54 function send_mail($message, $header, $boundary, $stream=false,
8eeb8469 55 &$raw_length, $folder=NULL) {
56
57 if (is_null($folder))
58 die('Internal error. Cannot pass NULL folder name to Deliver_IMAP::send_mail()');
e2ccf284 59
60 // write the body without providing a stream so we
61 // can calculate the final length - after this call,
62 // $final_length will be our correct final length value
63 //
64 $final_length = $raw_length;
65 $this->writeBody($message, 0, $final_length, $boundary);
66
67
68 // now if we have a real live stream, send the message
69 //
70 if ($stream) {
71 sqimap_append ($stream, $folder, $final_length);
72
73 $this->preWriteToStream($header);
74 $this->writeToStream($stream, $header);
75 $this->writeBody($message, $stream, $raw_length, $boundary);
76
77 sqimap_append_done ($stream, $folder);
78 }
79
80 }
81
82
91e0dccc 83 /* to do: finishing the imap-class so the initStream function can call the
d39ae420 84 imap-class */
e1ee60fe 85}