if ($pop3server == "") { echo "<span class=\"error\">POP3: 'POP3 Server' field not filled in.</span><br />"; } else { if ($_REQUEST["user"] == "") { echo "<span class=\"error\">POP3: 'Username' field not filled in.</span><br />"; } else { if ($_REQUEST["pass"] == "") { echo "<span class=\"error\">POP3: 'Password' field not filled in.</span><br />"; } } } } // Test SMTP again if POP3 succeeded. if ($pop3valid && !$smtpsent) { if ($smtpserver != "" && $_REQUEST["from"] != "" && $_REQUEST["to"] != "") { $result = SMTP::SendEmail($_REQUEST["from"], $_REQUEST["to"], "[SSO Server] Installer Test Message", $smtpoptions); if (!$result["success"]) { echo "<span class=\"error\">Failed to connect to the SMTP server. " . htmlspecialchars($result["error"]) . (isset($result["info"]) ? " (" . htmlspecialchars($result["info"]) . ")" : "") . "</span><br />"; } else { echo "<span class=\"success\">Successfully connected to the SMTP server.</span><br />"; $smtpsent = true; } } } } else { if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "install") { function InstallError($message) { echo "<span class=\"error\">" . $message . " Click 'Prev' below to go back and correct the problem.</span>"; echo "<script type=\"text/javascript\">InstallFailed();</script>"; exit;
function SSO_SendEmail($fromaddr, $toaddr, $subject, $htmlmsg, $textmsg) { if (!class_exists("SMTP")) { define("CS_TRANSLATE_FUNC", "BB_Translate"); require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/smtp.php"; } $headers = SMTP::GetUserAgent("Thunderbird"); $smtpoptions = array("headers" => $headers, "htmlmessage" => $htmlmsg, "textmessage" => $textmsg, "server" => SSO_SMTP_SERVER, "port" => SSO_SMTP_PORT, "secure" => SSO_SMTP_PORT == 465, "username" => SSO_SMTPPOP3_USER, "password" => SSO_SMTPPOP3_PASS); $result = SMTP::SendEmail($fromaddr, $toaddr, $subject, $smtpoptions); if (!$result["success"] && SSO_POP3_SERVER != "") { // Try POP-before-SMTP. require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/pop3.php"; $pop3options = array("server" => SSO_POP3_SERVER, "port" => SSO_POP3_PORT, "secure" => SSO_POP3_PORT == 995); $temppop3 = new POP3(); $result = $temppop3->Connect(SSO_SMTPPOP3_USER, SSO_SMTPPOP3_PASS, $pop3options); if ($result["success"]) { $temppop3->Disconnect(); $result = SMTP::SendEmail($fromaddr, $toaddr, $subject, $smtpoptions); } } return $result; }