/**
* compose.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This code sends a mail.
require_once(SM_PATH . 'functions/plugin.php');
require_once(SM_PATH . 'functions/display_messages.php');
require_once(SM_PATH . 'class/deliver/Deliver.class.php');
+require_once(SM_PATH . 'functions/addressbook.php');
/* --------------------- Get globals ------------------------------------- */
$username = $_SESSION['username'];
if (!isset($mailbox)) {
$mailbox = '';
}
-
if ($compose_new_win == '1') {
compose_Header($color, $mailbox);
} else {
$AttachFailure = saveAttachedFiles($session);
}
if (checkInput(false) && !isset($AttachFailure)) {
+ if ($mailbox == "All Folders") {
+ /* We entered compose via the search results page */
+ $mailbox="INBOX"; /* Send 'em to INBOX, that's safe enough */
+ }
$urlMailbox = urlencode (trim($mailbox));
if (! isset($passed_id)) {
$passed_id = 0;
$subject = $values['subject'];
$mailprio = $values['mailprio'];
$body = $values['body'];
- $identity = $values['identity'];
+ $identity = (int) $values['identity'];
}
if ($use_javascript_addr_book) {
$editor_size . '" WRAP="VIRTUAL">';
}
if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
+ if ($idents > 1) {
+ if ($identity == 'default') {
+ $no = 'g';
+ } else {
+ $no = $identity;
+ }
+ $signature = getSig($data_dir, $username, $no);
+ }
+
if ($sig_first == '1') {
if ($default_charset == 'iso-2022-jp') {
echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
$full_localfilename = "$hashed_attachment_dir/$localfilename";
}
+ // FIXME: we SHOULD prefer move_uploaded_file over rename because
+ // m_u_f works better with restricted PHP installes (safe_mode, open_basedir)
if (!@rename($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
- if (function_exists("move_uploaded_file")) {
if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
return true;
}
- } else {
- if (!@copy($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
- return true;
- }
- }
}
$message = $compose_messages[$session];
$type = strtolower($_FILES['attachfile']['type']);
global $imapServerAddress, $imapPort, $sent_folder, $key;
$rfc822_header = $composeMessage->rfc822_header;
- $rfc822_header->to = $rfc822_header->parseAddress($send_to,true, array(), '', $domain);
- $rfc822_header->cc = $rfc822_header->parseAddress($send_to_cc,true,array(), '',$domain);
- $rfc822_header->bcc = $rfc822_header->parseAddress($send_to_bcc,true, array(), '',$domain);
+
+ $abook = addressbook_init(false, true);
+
+ $rfc822_header->to = $rfc822_header->parseAddress($send_to,true, array(), '', $domain, array(&$abook,'lookup'));
+ $rfc822_header->cc = $rfc822_header->parseAddress($send_to_cc,true,array(), '',$domain, array(&$abook,'lookup'));
+ $rfc822_header->bcc = $rfc822_header->parseAddress($send_to_bcc,true, array(), '',$domain, array(&$abook,'lookup'));
$rfc822_header->priority = $mailprio;
$rfc822_header->subject = $subject;
$special_encoding='';
$succes = $deliver->finalizeStream($stream);
}
if (!$succes) {
- $msg = $deliver->dlv_msg . '<br>Server replied: '.$deliver->dlv_ret_nr;
+ $msg = $deliver->dlv_msg . '<br>' .
+ _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+ $deliver->dlv_server_msg;
plain_error_message($msg, $color);
} else {
unset ($deliver);