| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/sendmail.inc | |
| | | | | |
| | |
| | | $from = trim($m[1], '<>'); |
| | | else |
| | | $from = null; |
| | | } |
| | | |
| | | // check 'From' address (identity may be incomplete) |
| | | if (!$savedraft && !$saveonly && empty($from)) { |
| | | $OUTPUT->show_message('nofromaddress', 'error'); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | |
| | | if (!$from_string && $from) { |
| | |
| | | // pass headers to message object |
| | | $MAIL_MIME->headers($headers); |
| | | |
| | | // This hook allows to modify the message before send or save action |
| | | $plugin = $RCMAIL->plugins->exec_hook('message_ready', array('message' => $MAIL_MIME)); |
| | | $MAIL_MIME = $plugin['message']; |
| | | |
| | | // Begin SMTP Delivery Block |
| | | if (!$savedraft && !$saveonly) { |
| | | // check 'From' address (identity may be incomplete) |
| | | if (empty($from)) { |
| | | $OUTPUT->show_message('nofromaddress', 'error'); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | |
| | | // Handle Delivery Status Notification request |
| | | $smtp_opts['dsn'] = $dsn_enabled; |
| | | |
| | |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | } |
| | | |
| | | // delete previous saved draft |
| | | if ($saved && ($old_id = rcube_utils::get_input_value('_draft_saveid', rcube_utils::INPUT_POST))) { |
| | | $deleted = $RCMAIL->storage->delete_message($old_id, $drafts_mbox); |
| | | |
| | | // raise error if deletion of old draft failed |
| | | if (!$deleted) { |
| | | rcube::raise_error(array('code' => 800, 'type' => 'imap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Could not delete message from $drafts_mbox"), true, false); |
| | | } |
| | | } |
| | | } |
| | | // remove temp file |
| | | else if ($mailbody_file) { |
| | | unlink($mailbody_file); |
| | | } |
| | | |
| | | // delete previous saved draft |
| | | $old_id = rcube_utils::get_input_value('_draft_saveid', rcube_utils::INPUT_POST); |
| | | if ($old_id && ($sent || $saved)) { |
| | | $deleted = $RCMAIL->storage->delete_message($old_id, $drafts_mbox); |
| | | |
| | | // raise error if deletion of old draft failed |
| | | if (!$deleted) { |
| | | rcube::raise_error(array('code' => 800, 'type' => 'imap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Could not delete message from $drafts_mbox"), true, false); |
| | | } |
| | | } |
| | | |
| | | if ($savedraft) { |
| | | // remember new draft-uid ($saved could be an UID or true/false here) |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * clear message composing settings |
| | | */ |
| | | function rcmail_compose_cleanup($id) |
| | | { |
| | | if (!isset($_SESSION['compose_data_'.$id])) { |
| | | return; |
| | | } |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $rcmail->plugins->exec_hook('attachments_cleanup', array('group' => $id)); |
| | | $rcmail->session->remove('compose_data_'.$id); |
| | | |
| | | $_SESSION['last_compose_session'] = $id; |
| | | } |