print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=test&mode=init">' . $langs->trans("DoTestSend") . '</a>'; if (!empty($conf->fckeditor->enabled)) { print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testhtml&mode=init">' . $langs->trans("DoTestSendHTML") . '</a>'; } print '</div>'; // Run the test to connect if ($action == 'testconnect') { print '<br>'; print_titre($langs->trans("DoTestServerAvailability")); // If we use SSL/TLS if (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) { $server = 'ssl://' . $server; } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mail = new CMailFile('', '', '', ''); $result = $mail->check_server_port($server, $port); if ($result) { print '<div class="ok">' . $langs->trans("ServerAvailableOnIPOrPort", $server, $port) . '</div>'; } else { $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port); if ($mail->error) { $errormsg .= ' - ' . $mail->error; } setEventMessage($errormsg, 'errors'); } print '<br>'; } // Show email send test form if ($action == 'test' || $action == 'testhtml') { print '<br>'; print_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));