Basic mailto: support.
[squirrelmail.git] / src / compose.php
index 068c57d1111c358d9736e9987cc067dd10a04ae3..9b1b242022858871f2486012cd27014e1617590d 100644 (file)
@@ -553,6 +553,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
            $use_signature, $composesession, $data_dir, $username,
            $username, $key, $imapServerAddress, $imapPort, $compose_messages,
            $composeMessage;
+       global $languages, $squirrelmail_language;
 
     $send_to = $send_to_cc = $send_to_bcc = $subject = $identity = '';
     $mailprio = 3;
@@ -603,6 +604,12 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
                 $bodypart = str_replace(array('&nbsp;','&gt','&lt'),array(' ','<','>'),$bodypart);
                 $bodypart = strip_tags($bodypart);
             }
+            if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
+                function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
+                if (mb_detect_encoding($bodypart) != 'ASCII') {
+                    $bodypart = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $bodypart);
+                }
+            }
             $body .= $bodypart;
         }
         if ($default_use_priority) {
@@ -1312,7 +1319,7 @@ function deliverMessage($composeMessage, $draft=false) {
     global $send_to, $send_to_cc, $send_to_bcc, $mailprio, $subject, $body,
            $username, $popuser, $usernamedata, $identity, $data_dir,
            $request_mdn, $request_dr, $default_charset, $color, $useSendmail,
-           $domain, $action;
+           $domain, $action, $default_move_to_sent, $move_to_sent;
     global $imapServerAddress, $imapPort, $sent_folder, $key;
 
     $rfc822_header = $composeMessage->rfc822_header;
@@ -1462,9 +1469,10 @@ function deliverMessage($composeMessage, $draft=false) {
         plain_error_message($msg, $color);
     } else {
         unset ($deliver);
-        $imap_stream = sqimap_login($username, $key, $imapServerAddress,
-        $imapPort, 0);
-        if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
+        $move_to_sent = getPref($data_dir,$username,'move_to_sent');
+        $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+        if (sqimap_mailbox_exists ($imap_stream, $sent_folder) && ((isset($move_to_sent) && $move_to_sent) ||
+           (isset($default_move_to_sent) && $default_move_to_sent))) {
                 sqimap_append ($imap_stream, $sent_folder, $length);
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();