Example #1
0
    $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
    $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();