| | |
| | | } |
| | | |
| | | // remember reply/forward UIDs in special headers |
| | | if (!empty($COMPOSE['reply_uid']) && $savedraft) { |
| | | $headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $COMPOSE['reply_uid']); |
| | | } |
| | | else if (!empty($COMPOSE['forward_uid']) && $savedraft) { |
| | | $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => rcube_imap_generic::compressMessageSet($COMPOSE['forward_uid'])); |
| | | if ($savedraft) { |
| | | // Note: We ignore <UID>.<PART> forwards/replies here |
| | | if (($uid = $COMPOSE['reply_uid']) && !preg_match('/^\d+[0-9.]+$/', $uid)) { |
| | | $headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $uid); |
| | | } |
| | | else if (!empty($COMPOSE['forward_uid']) |
| | | && ($uid = rcube_imap_generic::compressMessageSet($COMPOSE['forward_uid'])) |
| | | && !preg_match('/^\d+[0-9.]+$/', $uid) |
| | | ) { |
| | | $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $uid); |
| | | } |
| | | } |
| | | |
| | | if (!empty($COMPOSE['reply_msgid'])) { |
| | |
| | | |
| | | // sending aborted by plugin |
| | | if ($data['abort'] && !$savedraft) { |
| | | $OUTPUT->show_message($data['message'] ? $data['message'] : 'sendingfailed'); |
| | | $OUTPUT->show_message($data['message'] ?: 'sendingfailed'); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | else { |
| | |
| | | $message_body = rcube_utils::get_input_value('_message', rcube_utils::INPUT_POST, TRUE, $message_charset); |
| | | |
| | | if (isset($_POST['_pgpmime'])) { |
| | | $pgp_mime = rcube_utils::get_input_value('_pgpmime', rcube_utils::INPUT_POST); |
| | | $message_body = 'This is an OpenPGP/MIME encrypted message (RFC 2440 and 3156)'; |
| | | $isHtml = false; |
| | | $pgp_mime = rcube_utils::get_input_value('_pgpmime', rcube_utils::INPUT_POST); |
| | | $isHtml = false; |
| | | $message_body = ''; |
| | | |
| | | // clear unencrypted attachments |
| | | foreach ($COMPOSE['attachments'] as $attach) { |
| | | foreach ((array) $COMPOSE['attachments'] as $attach) { |
| | | $RCMAIL->plugins->exec_hook('attachment_delete', $attach); |
| | | } |
| | | |
| | | $COMPOSE['attachments'] = array(); |
| | | } |
| | | |
| | |
| | | } |
| | | else { |
| | | $ctype = str_replace('image/pjpeg', 'image/jpeg', $attachment['mimetype']); // #1484914 |
| | | $file = $attachment['data'] ? $attachment['data'] : $attachment['path']; |
| | | $file = $attachment['data'] ?: $attachment['path']; |
| | | $folding = (int) $RCMAIL->config->get('mime_param_folding'); |
| | | |
| | | $MAIL_MIME->addAttachment($file, |
| | |
| | | |
| | | // compose PGP/Mime message |
| | | if ($pgp_mime) { |
| | | $MAIL_MIME->addAttachment( |
| | | 'Version: 1', |
| | | 'application/pgp-encrypted', |
| | | 'version.txt', // required by Mail_mime::addAttachment() |
| | | false, |
| | | '8bit', |
| | | '', // $disposition |
| | | '', // $charset |
| | | '', // $language |
| | | '', // $location |
| | | null, // $n_encoding |
| | | null, // $f_encoding |
| | | 'PGP/MIME version identification' |
| | | ); |
| | | $MAIL_MIME->addAttachment(new Mail_mimePart('Version: 1', array( |
| | | 'content_type' => 'application/pgp-encrypted', |
| | | 'description' => 'PGP/MIME version identification', |
| | | ))); |
| | | |
| | | // patch filename out of the version part |
| | | foreach ($MAIL_MIME->_parts as $_i => $_part) { |
| | | if ($_part['c_type'] == 'application/pgp-encrypted') { |
| | | $MAIL_MIME->_parts[$_i]['name'] = ''; |
| | | break; |
| | | } |
| | | } |
| | | $MAIL_MIME->addAttachment(new Mail_mimePart($pgp_mime, array( |
| | | 'content_type' => 'application/octet-stream', |
| | | 'filename' => 'encrypted.asc', |
| | | 'disposition' => 'inline', |
| | | ))); |
| | | |
| | | $MAIL_MIME->addAttachment( |
| | | $pgp_mime, |
| | | 'application/octet-stream', |
| | | 'encrypted.asc', |
| | | false, |
| | | '8bit', |
| | | 'inline' |
| | | ); |
| | | |
| | | $MAIL_MIME->setContentType('multipart/encrypted', array('protocol' => "application/pgp-encrypted")); |
| | | $MAIL_MIME->setContentType('multipart/encrypted', array('protocol' => 'application/pgp-encrypted')); |
| | | $MAIL_MIME->setParam('preamble', 'This is an OpenPGP/MIME encrypted message (RFC 2440 and 3156)'); |
| | | } |
| | | |
| | | // encoding settings for mail composing |
| | |
| | | // set replied/forwarded flag |
| | | if ($COMPOSE['reply_uid']) { |
| | | foreach (rcmail::get_uids($COMPOSE['reply_uid'], $COMPOSE['mailbox']) as $mbox => $uids) { |
| | | $RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox); |
| | | // skip <UID>.<PART> replies |
| | | if (!preg_match('/^\d+[0-9.]+$/', implode(',', (array) $uids))) { |
| | | $RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox); |
| | | } |
| | | } |
| | | } |
| | | else if ($COMPOSE['forward_uid']) { |
| | | foreach (rcmail::get_uids($COMPOSE['forward_uid'], $COMPOSE['mailbox']) as $mbox => $uids) { |
| | | $RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox); |
| | | // skip <UID>.<PART> forwards |
| | | if (!preg_match('/^\d+[0-9.]+$/', implode(',', (array) $uids))) { |
| | | $RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | array('msgid' => $message_id, 'uid' => $saved, 'folder' => $store_target)); |
| | | |
| | | // display success |
| | | $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'messagesaved', 'confirmation'); |
| | | $OUTPUT->show_message($plugin['message'] ?: 'messagesaved', 'confirmation'); |
| | | |
| | | // update "_draft_saveid" and the "cmp_hash" to prevent "Unsaved changes" warning |
| | | $COMPOSE['param']['draft_uid'] = $plugin['uid']; |