Example #1
0
// Print the message sent
$var['emailmessage'] = $_REQUEST['emailmessage'];
// cleanup xss issues
$var['emailmessage'] = $atmail->escape_jscript($var['emailmessage']);
if (strpos($var['contype'], 'html') === false) {
    $var['emailmessage'] = nl2br($var['emailmessage']);
}
// Delete the attach files (if any)
$sendmsg->delete_attachments();
// When printing the message, change the <> chars , so not to confuse the browser
// Also strip the @ for Groups
foreach (array('EmailTo', 'EmailCC', 'EmailBCC') as $v) {
    $key = strtolower($v);
    $var[$key] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $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