$var['DraftID'] = $_REQUEST['DraftID']; $var['ReadReceipt'] = $_REQUEST['ReadReceipt']; $var['Draft'] = $_REQUEST['Draft']; $var['VideoStream'] = $_REQUEST['VideoStream']; $var['id'] = $_REQUEST['id']; // format the addresses foreach (array('emailto', 'emailcc', 'emailbcc') as $k) { $var[$k] = ReadMsg::cleanEmailAddress($var[$k]); } // Switch to our default character-set if not defined if (!$var['Charset']) { $var['Charset'] = $atmail->EmailEncoding; } // Make a new UIDL if one does not exist if (!$var['UIDL']) { $var['UIDL'] = time() . getmypid() . rand(0, 9000) . $atmail->genkey(); $var['UIDL'] = preg_replace('/\\..*/', '', $var['UIDL']); } // Find which EmailBox to save into if ($_REQUEST['Draft']) { $var['msgbox'] = 'Drafts'; } else { $var['msgbox'] = 'Sent'; } // Build the message to send . Add the headers, message body and UIDL $sendmsg = new SendMsg(array('Account' => "{$atmail->username}@{$atmail->pop3host}", 'EmailTo' => $var['emailto'], 'EmailFrom' => $var['emailfrom'], 'EmailCC' => $var['emailcc'], 'EmailBCC' => $var['emailbcc'], 'EmailSubject' => $var['emailsubject'], 'EmailPriority' => $var['emailpriority'], 'ContentType' => $var['contype'], 'XMailer' => "AtMail {$pref['version']}", 'EmailBox' => $var['msgbox'], 'EmailUIDL' => $var['UIDL'], 'Unique' => $var['unique'], 'X-Origin' => $_SERVER['REMOTE_ADDR'], 'EmailMessage' => $_REQUEST['emailmessage'], 'SessionID' => $auth->SessionID, 'PGPappend' => $atmail->PGPappend, 'PGPsign' => $atmail->PGPsign, 'SMIMEencrypt' => $var['SMIMEencrypt'], 'SMIMEsign' => $var['SMIMEsign'], 'Charset' => $var['Charset'], 'ReadReceipt' => $var['ReadReceipt'], 'ReplyFwd' => $var['type'], 'VideoStream' => $var['VideoStream'])); // Save the message into the Sent users folder // Create a new mail object $mail = new GetMail(array('Username' => $atmail->username, 'Pop3host' => $atmail->pop3host, 'Password' => $auth->password, 'Type' => $atmail->MailType, 'Mode' => $atmail->Mode)); $mail->login(); // Build the email message to send