X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fcompose.php;h=b548153f887ade6281a2269058ffb8b9446ab348;hp=297cccd250c803b3018f098086b2bd56b257758e;hb=a90d951c398971d2a31cfc47f6f6a5859929d17f;hpb=5b009cf2e8e47dd7630b57f2366f636f7cdfe592 diff --git a/src/compose.php b/src/compose.php index 297cccd2..b548153f 100644 --- a/src/compose.php +++ b/src/compose.php @@ -154,7 +154,7 @@ if ( sqgetGlobalVar('mailtodata', $mailtodata, SQ_GET) ) { 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(); @@ -441,7 +441,7 @@ if ($draft) { 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 '


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 @@ -1003,7 +1004,7 @@ function getAttachments($message, &$composeMessage, $passed_id, $entities, $imap if ($filename == "") { $filename = "untitled-".$message->entity_id; } - $filename .= '.msg'; + $filename .= '.eml'; } else { $filename = $message->getFilename(); } @@ -1066,7 +1067,7 @@ function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $fp = fopen($hashed_attachment_dir . '/' . $localfilename, 'wb'); fwrite ($fp, $body); fclose($fp); - $composeMessage->initAttachment('message/rfc822',$subject.'.msg', + $composeMessage->initAttachment('message/rfc822',$subject.'.eml', $localfilename); } return $composeMessage; @@ -1468,8 +1469,18 @@ function getByteSize($ini_size) { * 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, @@ -1512,7 +1523,8 @@ function deliverMessage($composeMessage, $draft=false) { } /* 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']); @@ -1594,11 +1606,11 @@ function deliverMessage($composeMessage, $draft=false) { if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) { require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php'); $imap_deliver = new Deliver_IMAP(); - $length = $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, $imap_stream, $draft_folder); sqimap_logout($imap_stream); unset ($imap_deliver); $composeMessage->purgeAttachments(); - return $length; + return $success; } else { $msg = '
'.sprintf(_("Error: Draft folder %s does not exist."), htmlspecialchars($draft_folder)); plain_error_message($msg); @@ -1607,7 +1619,7 @@ function deliverMessage($composeMessage, $draft=false) { } $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) { @@ -1709,7 +1721,7 @@ function deliverMessage($composeMessage, $draft=false) { } 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, $sent_folder); + $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, $reply_ent_id, $imap_stream, $sent_folder); unset ($imap_deliver); }