- case ('draft'):
- $use_signature = FALSE;
- $composeMessage->rfc822_header = $orig_header;
- $send_to = decodeHeader($orig_header->getAddr_s('to'),false,true);
- $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,true);
- $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,true);
- $subject = decodeHeader($orig_header->subject,false,true);
-// /* remember the references and in-reply-to headers in case of an reply */
-// $composeMessage->rfc822_header->more_headers['References'] = $orig_header->references;
-// $composeMessage->rfc822_header->more_headers['In-Reply-To'] = $orig_header->in_reply_to;
- $body_ary = explode("\n", $body);
- $cnt = count($body_ary) ;
- $body = '';
- for ($i=0; $i < $cnt; $i++) {
- if (!ereg("^[>\\s]*$", $body_ary[$i]) || !$body_ary[$i]) {
- sqWordWrap($body_ary[$i], $editor_size );
- $body .= $body_ary[$i] . "\n";
- }
- unset($body_ary[$i]);
- }
- sqUnWordWrap($body);
- $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
- break;
- case ('edit_as_new'):
- $send_to = decodeHeader($orig_header->getAddr_s('to'),false,true);
- $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,true);
- $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,true);
- $subject = decodeHeader($orig_header->subject,false,true);
- $mailprio = $orig_header->priority;
- $orig_from = '';
- $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
- sqUnWordWrap($body);
- break;
- case ('forward'):
- $send_to = '';
- $subject = decodeHeader($orig_header->subject,false,true);
- if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
- (substr(strtolower($subject), 0, 5) != '[fwd:') &&
- (substr(strtolower($subject), 0, 6) != '[ fwd:')) {
- $subject = '[Fwd: ' . $subject . ']';
- }
- $body = getforwardHeader($orig_header) . $body;
- sqUnWordWrap($body);
- $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
- $body = "\n" . $body;
- break;
- case ('forward_as_attachment'):
- $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection);
- $body = '';
- break;
- case ('reply_all'):
- $send_to_cc = replyAllString($orig_header);
- $send_to_cc = decodeHeader($send_to_cc,false,true);
- case ('reply'):
- $send_to = $orig_header->reply_to;
- if (is_array($send_to) && count($send_to)) {
- $send_to = $orig_header->getAddr_s('reply_to');
- } else if (is_object($send_to)) { /* unnessecarry, just for falesafe purpose */
- $send_to = $orig_header->getAddr_s('reply_to');
- } else {
- $send_to = $orig_header->getAddr_s('from');
- }
- $send_to = decodeHeader($send_to,false,true);
- $subject = decodeHeader($orig_header->subject,false,true);
- $subject = str_replace('"', "'", $subject);
- $subject = trim($subject);
- if (substr(strtolower($subject), 0, 3) != 're:') {
- $subject = 'Re: ' . $subject;
- }
- /* this corrects some wrapping/quoting problems on replies */
- $rewrap_body = explode("\n", $body);
- $from = (is_array($orig_header->from)) ? $orig_header->from[0] : $orig_header->from;
- sqUnWordWrap($body);
- $body = '';
- $cnt = count($rewrap_body);
- for ($i=0;$i<$cnt;$i++) {
- sqWordWrap($rewrap_body[$i], ($editor_size));
- if (preg_match("/^(>+)/", $rewrap_body[$i], $matches)) {
- $gt = $matches[1];
- $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($rewrap_body[$i])) ."\n";
+ case ('draft'):
+ $use_signature = FALSE;
+ $composeMessage->rfc822_header = $orig_header;
+ $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false,true);
+ $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false,true);
+ $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false,true);
+ $send_from = $orig_header->getAddr_s('from');
+ $send_from_parts = new AddressStructure();
+ $send_from_parts = $orig_header->parseAddress($send_from);
+ $send_from_add = $send_from_parts->mailbox . '@' . $send_from_parts->host;
+ $identity = find_identity(array($send_from_add));
+ $subject = decodeHeader($orig_header->subject,false,false,true);
+
+ // Remember the receipt settings
+ $request_mdn = $mdn_user_support && !empty($orig_header->dnt) ? '1' : '0';
+ $request_dr = $mdn_user_support && !empty($orig_header->drnt) ? '1' : '0';
+
+ /* remember the references and in-reply-to headers in case of an reply */
+ $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
+ sqBodyWrap($body, $editor_size);
+ $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
+ break;
+ case ('edit_as_new'):
+ $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false,true);
+ $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false,true);
+ $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false,true);
+ $subject = decodeHeader($orig_header->subject,false,false,true);
+ $mailprio = $orig_header->priority;
+ $orig_from = '';
+ $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
+ // rewrap the body to clean up quotations and line lengths
+ sqBodyWrap($body, $editor_size);
+ break;
+ case ('forward'):
+ $send_to = '';
+ $subject = getforwardSubject(decodeHeader($orig_header->subject,false,false,true));
+ $body = getforwardHeader($orig_header) . $body;
+ // the logic for calling sqUnWordWrap here would be to allow the browser to wrap the lines
+ // forwarded message text should be as undisturbed as possible, so commenting out this call
+ // sqUnWordWrap($body);
+ $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
+
+ //add a blank line after the forward headers
+ $body = "\n" . $body;
+ break;
+ case ('forward_as_attachment'):
+ $subject = getforwardSubject(decodeHeader($orig_header->subject,false,false,true));
+ $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection);
+ $body = '';
+ break;
+ case ('reply_all'):
+ if(isset($orig_header->mail_followup_to) && $orig_header->mail_followup_to) {
+ $send_to = $orig_header->getAddr_s('mail_followup_to');