- 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 = getforwardSubject(decodeHeader($orig_header->subject,false,true));
- $body = getforwardHeader($orig_header) . $body;
- sqUnWordWrap($body);
- $composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
- $body = "\n" . $body;
- break;
- case ('forward_as_attachment'):
- $subject = getforwardSubject(decodeHeader($orig_header->subject,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');
- } else {
- $send_to_cc = replyAllString($orig_header);
- $send_to_cc = decodeHeader($send_to_cc,false,true);
- }
- case ('reply'):
- // skip this if send_to was already set right above here
- if(!$send_to) {
- $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)) { /* unneccesarry, just for failsafe purpose */
- $send_to = $orig_header->getAddr_s('reply_to');
+ $subject = decodeHeader($orig_header->subject,false,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;
+ // 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');