thomascube
2008-09-06 0b6c1cf2b2f9530706bd7e4be2a2b08fa3754ce7
program/steps/mail/sendmail.inc
@@ -21,11 +21,17 @@
*/
if (!isset($_SESSION['compose']['id']))
  {
  rcmail_overwrite_action('list');
  return;
  }
// remove all scripts and act as called in frame
$OUTPUT->reset();
$OUTPUT->framed = TRUE;
if (!isset($_SESSION['compose']['id'])) {
  raise_error(array('code' => 500, 'file' => __FILE__, 'message' => "Invalid compose ID"), true, false);
  console("Sendmail error", $_SESSION['compose']);
  $OUTPUT->show_message("An internal error occured. Please try again.", 'error');
  $OUTPUT->send('iframe');
}
/****** message sending functions ********/
@@ -115,10 +121,6 @@
$message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $RCMAIL->config->mail_domain($_SESSION['imap_host']));
$savedraft = !empty($_POST['_draft']) ? TRUE : FALSE;
// remove all scripts and act as called in frame
$OUTPUT->reset();
$OUTPUT->framed = TRUE;
/****** check submission and compose message ********/
@@ -221,15 +223,19 @@
if (!empty($CONFIG['useragent']))
  $headers['User-Agent'] = $CONFIG['useragent'];
$isHtmlVal = strtolower(get_input_value('_is_html', RCUBE_INPUT_POST));
$isHtml = ($isHtmlVal == "1");
// fetch message body
$message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset);
// remove signature's div ID
if (!$savedraft && $isHtml)
  $message_body = preg_replace('/\s*id="_rc_sig"/', '', $message_body);
// append generic footer to all messages
if (!$savedraft && !empty($CONFIG['generic_message_footer']) && ($footer = file_get_contents(realpath($CONFIG['generic_message_footer']))))
  $message_body .= "\r\n" . rcube_charset_convert($footer, 'UTF-8', $message_charset);
$isHtmlVal = strtolower(get_input_value('_is_html', RCUBE_INPUT_POST));
$isHtml = ($isHtmlVal == "1");
// create extended PEAR::Mail_mime instance
$MAIL_MIME = new rcube_mail_mime($RCMAIL->config->header_delimiter());
@@ -288,11 +294,11 @@
      // .eml attachments send inline
      $MAIL_MIME->addAttachment($attachment['path'],
   $ctype,
        $ctype,
        $attachment['name'], true, 
   ($ctype == 'message/rfc822' ? $transfer_encoding : 'base64'),
        ($ctype == 'message/rfc822' ? $transfer_encoding : 'base64'),
        ($ctype == 'message/rfc822' ? 'inline' : 'attachment'),
   $message_charset);
        $message_charset);
    }
  }
@@ -366,9 +372,9 @@
    {
      // folder may be existing but not subscribed (#1485241)
      if (!in_array_nocase($store_target, $IMAP->list_unsubscribed()))
   $store_folder = $IMAP->create_mailbox($store_target, TRUE);
        $store_folder = $IMAP->create_mailbox($store_target, TRUE);
      else if ($IMAP->subscribe($store_target))
   $store_folder = TRUE;
        $store_folder = TRUE;
    }
  else
    $store_folder = TRUE;