unset($mailtodata,$mtdata, $trtable);
}
-/* Location (For HTTP 1.1 Header("Location: ...") redirects) */
+/* Location (For HTTP 1.1 header("Location: ...") redirects) */
$location = get_location();
/* Identities (fetch only once) */
$idents = get_identities();
if ($compose_new_win == '1') {
if ( !isset($pageheader_sent) || !$pageheader_sent ) {
- Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
+ header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
} else {
//FIXME: DON'T ECHO HTML FROM CORE!
echo ' <br><br><div style="text-align: center;"><a href="' . $location
exit();
} else {
if ( !isset($pageheader_sent) || !$pageheader_sent ) {
- Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
+ header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
"&startMessage=1¬e=".urlencode($draft_message));
} else {
//FIXME: DON'T ECHO HTML FROM CORE!
// NOTE: this hook changed in 1.5.2 from sending $Result and
// $composeMessage as args #2 and #3 to being in an array
// under arg #2
- do_hook('compose_send_after', $temp=array(&$Result, &$composeMessage, &$mail_sent));
+ $temp = array(&$Result, &$composeMessage, &$mail_sent);
+ do_hook('compose_send_after', $temp);
if (! $Result) {
showInputForm($session);
exit();
if ($compose_new_win == '1') {
if ( !isset($pageheader_sent) || !$pageheader_sent ) {
- Header("Location: $location/compose.php?mail_sent=$mail_sent");
+ header("Location: $location/compose.php?mail_sent=$mail_sent");
} else {
//FIXME: DON'T ECHO HTML FROM CORE!
echo ' <br><br><div style="text-align: center;"><a href="' . $location
exit();
} else {
if ( !isset($pageheader_sent) || !$pageheader_sent ) {
- Header("Location: $location/right_main.php?mailbox=$urlMailbox".
+ header("Location: $location/right_main.php?mailbox=$urlMailbox".
"&startMessage=$startMessage&mail_sent=$mail_sent");
} else {
//FIXME: DON'T ECHO HTML FROM CORE!
$request_dr = $mdn_user_support && !empty($orig_header->drnt) ? '1' : '0';
/* remember the references and in-reply-to headers in case of an reply */
+//FIXME: it would be better to fiddle with headers inside of the message object or possibly when delivering the message to its destination (drafts folder?); is this possible?
$composeMessage->rfc822_header->more_headers['References'] = $orig_header->references;
$composeMessage->rfc822_header->more_headers['In-Reply-To'] = $orig_header->in_reply_to;
// rewrap the body to clean up quotations and line lengths
* In the future the responsible backend should be automaticly loaded
* and conf.pl should show a list of available backends.
* The message also should be constructed by the message class.
+ *
+ * @param object $composeMessage The message being sent. Please note
+ * that it is passed by reference and
+ * will be returned modified, with additional
+ * headers, such as Message-ID, Date, In-Reply-To,
+ * References, and so forth.
+ *
+ * @return boolean FALSE if delivery failed, or some non-FALSE value
+ * upon success.
+ *
*/
-function deliverMessage($composeMessage, $draft=false) {
+function deliverMessage(&$composeMessage, $draft=false) {
global $send_to, $send_to_cc, $send_to_bcc, $mailprio, $subject, $body,
$username, $identity, $idents, $data_dir,
$request_mdn, $request_dr, $default_charset, $useSendmail,
}
/* Receipt: On Delivery */
- if (isset($request_dr) && $request_dr) {
+ if (!empty($request_dr)) {
+//FIXME: it would be better to fiddle with headers inside of the message object or possibly when delivering the message to its destination; is this possible?
$rfc822_header->more_headers['Return-Receipt-To'] = $from->mailbox.'@'.$from->domain;
} elseif (isset($rfc822_header->more_headers['Return-Receipt-To'])) {
unset($rfc822_header->more_headers['Return-Receipt-To']);
if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
$imap_deliver = new Deliver_IMAP();
- $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $draft_folder);
+ $success = $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $draft_folder);
sqimap_logout($imap_stream);
unset ($imap_deliver);
$composeMessage->purgeAttachments();
- return $length;
+ return $success;
} else {
$msg = '<br />'.sprintf(_("Error: Draft folder %s does not exist."), htmlspecialchars($draft_folder));
plain_error_message($msg);
}
$success = false;
if ($stream) {
- $length = $deliver->mail($composeMessage, $stream, $reply_id, $reply_ent_id);
+ $deliver->mail($composeMessage, $stream, $reply_id, $reply_ent_id);
$success = $deliver->finalizeStream($stream);
}
if (!$success) {