die("requested folder does not exist"); } $fol = array(); // Create the select box for moving messages to another folder $var['folderbox'] = $mail->folder_select($var['folder'], $folders); $var['folderbox'] = $mail->folder_select_lang($var['folderbox'], $atmail->Language); // By default, we want to move to Trash $var['folderbox'] = str_replace("value=\"Trash\"", "value=\"Trash\" selected", $var['folderbox']); // If the user has set the messages to another flag; update the UIDL database. if ($var['flag'] && $msgs[0]) { $c = 0; foreach ($msgs as $id) { $folder = urldecode($_REQUEST['folders'][$c]); // Load a hash containing the message headers $db = $mail->gethead($id, $folder, 5); $mail->updateuidl($db['EmailUIDL'], $var['flag'], '1', $folder, $id); $c++; } print <<<EOF <?xml version="1.0" ?> <MovedMsgs> <status>1</status> <message>Changed message status</message> </MovedMsgs> EOF; // Exit our mail session, avoid mailbox lock $mail->quit(); $atmail->end(); } elseif ($msgs && $var['newfolder']) { // Loop through the selected msgs to delete, if any. // Automatically delete messages if AutoTrash is defined
$key = strtolower($v); $var[$key] = str_replace(array('<', '>'), array('<', '>'), $sendmsg->{$v}); $var[$key] = preg_replace('/@((Shared)?Group)(?=[^a-zA-Z0-9\\-.]*)/', '$1', $var[$key]); $var[$key] = $mail->quote_header($var[$key]); } // Receive a list of recipients from the user $var['AddRecipients'] = $sendmsg->AddRecipients; // Quote the email-message, subject & to fields ( e.g if in another language like Japanese ) #$var['emailmessage'] = Atmail::GetMail->decode_language("", $var['emailmessage'] ); $var['emailsubject'] = $mail->quote_header($sendmsg->EmailSubject); // If the user is replying to a draft, delete the original copy from the server if ($var['DraftID']) { // Remove the message from the drafts folder $mail->move($var['DraftID'], "Drafts", "erase", 1); } // Fix for IMAP update UIDL if (!empty($var['id'])) { $update_id = $pref['install_type'] != "server" && $mail->Type == 'imap' ? $var['id'] : "cur/{$var['UIDL']}"; // Update the email UIDL/unique-id if the message is a reply or forward $mail->updateuidl($var['UIDL'], $var['type'], '', "Inbox", $update_id); } // Log the sent message only if not in server mode if (!$_REQUEST['Draft']) { $log->write_log("SendMail", "{$_SERVER['REMOTE_ADDR']}:{$var['emailto']} {$var['emailcc']} {$var['emailbcc']}"); } // Append the message to the server $sentuid = $mail->append($sendmsg->EmailBox, $sendmsg->headers . "\r\n\r\n" . $sendmsg->body); //$mail->mailer->markAsFlag($sentuid, '+FLAGS', '\\Answered'); // Display the sent-message template to the user print $atmail->parse("html/{$atmail->Language}/{$atmail->LoginType}/sendmsg_ajax.html", array_merge(array('Status' => '0', 'StatusMessage' => 'Sent'), $var)); $atmail->end();