}
//Get the paper information
$paperID = $_POST["paperID"];
$paperInfo = get_paper_info($paperID);
$type = $_POST["type"];
$presType = $_POST["presType"];
//Retrieve the setting information
$settingInfo = get_Conference_Settings();
$conferenceInfo = get_conference_info();
//Format the subject of the letter
$strSubject = format_Letter_Subject(stripslashes($_POST["subject"]));
//Format the content string and Store the content into the session
$strContent = stripslashes(wordwrap($_POST["bodycontent"])) . "\n\n";
$strContent .= $settingInfo->EmailSignature . "\n\n";
//Get the constant of the letter and highlight the constants
$arrConstants = evaluate_Letter_Constants($letterType);
//Get the paper info
$strAuthors = retrieve_authors($paperID, &$err_message);
$strCat = getSelectedCategoryCommaSeparated($paperID, &$err_message);
//Get the full name of the user according to his user name
$strFullName = getMemberFullName($paperInfo->MemberName);
$arrReplaceInfo = array("fullname" => $strFullName, "paperID" => $paperInfo->PaperID, "papertitle" => $paperInfo->Title, "authors" => $strAuthors, "papercat" => $strCat, "url" => $settingInfo->HomePage, "confname" => $conferenceInfo->ConferenceName, "confcode" => $conferenceInfo->ConferenceCodeName, "contact" => $conferenceInfo->ConferenceContact, "presType" => $presType);
//Replace the dynamice constants with real values
$strContent = replace_Dynamic_Values($arrConstants, $arrReplaceInfo, $strContent);
//Store the content into the session
$arrContent["subject"] = $strSubject;
$arrContent["content"] = $strContent;
$_SESSION["content"] = $arrContent;
do_html_header($letterTitle);
?>
<form name="form1" method="post" action="process_accept_reject_mail.php">
$accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => "");
authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message);
//Get the session variable
$arrLetterInfo =& $_SESSION["arrLetterInfo"];
$arrPassword =& $_SESSION["arrPassword"];
if ($_POST["Submit"] == "Back") {
    unset($_SESSION["arrContent"]);
    $url = "Location: send_account_info.php?lettertype=" . $arrLetterInfo["lettertype"];
    header($url);
    exit;
}
//get the conference info to get the contact mail
$conferenceInfo = get_conference_info();
//Get the letter info and its constant
$letterInfo = get_Letter_Info($arrLetterInfo["letterID"]);
$arrConstants = evaluate_Letter_Constants($arrLetterInfo["lettertype"]);
//Check if there is session email list to retrieve out
if (isset($_SESSION["arrUpdateEmails"])) {
    $arrEmails = $_SESSION["arrUpdateEmails"];
} else {
    $arrEmails = get_Unsended_EmailList($letterInfo->LetterID, $letterInfo->RecipientGroupName);
}
$arrContent = $_SESSION["arrContent"];
//Call the function to setup reviwer account
while (list($memberName, $email) = each($arrEmails)) {
    //Update the mail log
    $result = updateMailLog($memberName, $letterInfo->LetterID);
    if ($result === true) {
        //Successful Mail Log update
        //Now update the user password
        $result = updateUserPassword($memberName, $arrPassword[$memberName]);
        $letterTitle = "Reviewer Account Info";
        break;
    case "adminaccount":
        $letterTitle = "Admin Account Info";
        break;
}
//Retrieve the setting information
$settingInfo = get_Conference_Settings();
$conferenceInfo = get_conference_info();
//Format the subject of the letter
$strSubject = format_Letter_Subject(stripslashes($_POST["subject"]));
//Format the content string and Store the content into the session
$strContent = stripslashes(wordwrap($_POST["bodycontent"])) . "\n\n";
$strContent .= $settingInfo->EmailSignature . "\n\n";
//Get the constant of the letter and highlight the constants
$arrConstants = evaluate_Letter_Constants($_POST["lettertype"]);
$arrReplaceInfo = array("fullname" => $_POST["fullname"], "username" => $_POST["loginname"], "url" => $settingInfo->HomePage, "confname" => $conferenceInfo->ConferenceName, "confcode" => $conferenceInfo->ConferenceCodeName, "contact" => $conferenceInfo->ConferenceContact);
//Generate the password for that users
$password = generate_password();
//Add the password into arrReplaceInfo to replace the password
$arrReplaceInfo["password"] = $password;
$strContent = replace_Dynamic_Values($arrConstants, $arrReplaceInfo, $strContent);
//Put in the return formatted content into array
$arrContent["subject"] = $strSubject;
$arrContent["content"] = $strContent;
$arrContent["password"] = $password;
//Store the content into the session
$_SESSION["content"] = $arrContent;
do_html_header($letterTitle);
?>