Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

605 rindas
27KB

  1. <?php
  2. /*
  3. * A web form that both generates and uses PHPMailer code.
  4. * revised, updated and corrected 27/02/2013
  5. * by matt.sturdy@gmail.com
  6. */
  7. require '../PHPMailerAutoload.php';
  8. $CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
  9. $CFG['smtp_debugoutput'] = 'html';
  10. $CFG['smtp_server'] = 'localhost';
  11. $CFG['smtp_port'] = '25';
  12. $CFG['smtp_authenticate'] = false;
  13. $CFG['smtp_username'] = 'name@example.com';
  14. $CFG['smtp_password'] = 'yourpassword';
  15. $CFG['smtp_secure'] = 'None';
  16. $from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : '';
  17. $from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : '';
  18. $to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : '';
  19. $to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : '';
  20. $cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : '';
  21. $bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : '';
  22. $subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : '';
  23. $message = (isset($_POST['Message'])) ? $_POST['Message'] : '';
  24. $test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp';
  25. $smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug'];
  26. $smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server'];
  27. $smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port'];
  28. $smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']);
  29. $smtp_authenticate = (isset($_POST['smtp_authenticate'])) ?
  30. $_POST['smtp_authenticate'] : $CFG['smtp_authenticate'];
  31. $authenticate_password = (isset($_POST['authenticate_password'])) ?
  32. $_POST['authenticate_password'] : $CFG['smtp_password'];
  33. $authenticate_username = (isset($_POST['authenticate_username'])) ?
  34. $_POST['authenticate_username'] : $CFG['smtp_username'];
  35. // storing all status output from the script to be shown to the user later
  36. $results_messages = array();
  37. // $example_code represents the "final code" that we're using, and will
  38. // be shown to the user at the end.
  39. $example_code = "\nrequire_once '../PHPMailerAutoload.php';";
  40. $example_code .= "\n\n\$results_messages = array();";
  41. $mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
  42. $mail->CharSet = 'utf-8';
  43. ini_set('default_charset', 'UTF-8');
  44. $mail->Debugoutput = $CFG['smtp_debugoutput'];
  45. $example_code .= "\n\n\$mail = new PHPMailer(true);";
  46. $example_code .= "\n\$mail->CharSet = 'utf-8';";
  47. $example_code .= "\nini_set('default_charset', 'UTF-8');";
  48. class phpmailerAppException extends phpmailerException
  49. {
  50. }
  51. $example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}";
  52. $example_code .= "\n\ntry {";
  53. // Convert a string to its JavaScript representation.
  54. function JSString($s) {
  55. static $from = array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"');
  56. static $to = array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\\"');
  57. return is_null($s)? 'null': '"' . str_replace($from, $to, "$s") . '"';
  58. }
  59. try {
  60. if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") {
  61. $to = $to_email;
  62. if (!PHPMailer::validateAddress($to)) {
  63. throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
  64. }
  65. $example_code .= "\n\$to = '" . addslashes($to_email) . "';";
  66. $example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {";
  67. $example_code .= "\n throw new phpmailerAppException(\"Email address \" . " .
  68. "\$to . \" is invalid -- aborting!\");";
  69. $example_code .= "\n}";
  70. switch ($test_type) {
  71. case 'smtp':
  72. $mail->isSMTP(); // telling the class to use SMTP
  73. $mail->SMTPDebug = (integer)$smtp_debug;
  74. $mail->Host = $smtp_server; // SMTP server
  75. $mail->Port = (integer)$smtp_port; // set the SMTP port
  76. if ($smtp_secure) {
  77. $mail->SMTPSecure = strtolower($smtp_secure);
  78. }
  79. $mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication?
  80. if (array_key_exists('smtp_authenticate', $_POST)) {
  81. $mail->Username = $authenticate_username; // SMTP account username
  82. $mail->Password = $authenticate_password; // SMTP account password
  83. }
  84. $example_code .= "\n\$mail->isSMTP();";
  85. $example_code .= "\n\$mail->SMTPDebug = " . (integer) $smtp_debug . ";";
  86. $example_code .= "\n\$mail->Host = \"" . addslashes($smtp_server) . "\";";
  87. $example_code .= "\n\$mail->Port = \"" . addslashes($smtp_port) . "\";";
  88. $example_code .= "\n\$mail->SMTPSecure = \"" . addslashes(strtolower($smtp_secure)) . "\";";
  89. $example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists(
  90. 'smtp_authenticate',
  91. $_POST
  92. ) ? 'true' : 'false') . ";";
  93. if (array_key_exists('smtp_authenticate', $_POST)) {
  94. $example_code .= "\n\$mail->Username = \"" . addslashes($authenticate_username) . "\";";
  95. $example_code .= "\n\$mail->Password = \"" . addslashes($authenticate_password) . "\";";
  96. }
  97. break;
  98. case 'mail':
  99. $mail->isMail(); // telling the class to use PHP's mail()
  100. $example_code .= "\n\$mail->isMail();";
  101. break;
  102. case 'sendmail':
  103. $mail->isSendmail(); // telling the class to use Sendmail
  104. $example_code .= "\n\$mail->isSendmail();";
  105. break;
  106. case 'qmail':
  107. $mail->isQmail(); // telling the class to use Qmail
  108. $example_code .= "\n\$mail->isQmail();";
  109. break;
  110. default:
  111. throw new phpmailerAppException('Invalid test_type provided');
  112. }
  113. try {
  114. if ($_POST['From_Name'] != '') {
  115. $mail->addReplyTo($from_email, $from_name);
  116. $mail->setFrom($from_email, $from_name);
  117. $example_code .= "\n\$mail->addReplyTo(\"" .
  118. addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
  119. $example_code .= "\n\$mail->setFrom(\"" .
  120. addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
  121. } else {
  122. $mail->addReplyTo($from_email);
  123. $mail->setFrom($from_email, $from_email);
  124. $example_code .= "\n\$mail->addReplyTo(\"" . addslashes($from_email) . "\");";
  125. $example_code .= "\n\$mail->setFrom(\"" .
  126. addslashes($from_email) . "\", \"" . addslashes($from_email) . "\");";
  127. }
  128. if ($_POST['To_Name'] != '') {
  129. $mail->addAddress($to, $to_name);
  130. $example_code .= "\n\$mail->addAddress(\"$to\", \"" . addslashes($to_name) . "\");";
  131. } else {
  132. $mail->addAddress($to);
  133. $example_code .= "\n\$mail->addAddress(\"$to\");";
  134. }
  135. if ($_POST['bcc_Email'] != '') {
  136. $indiBCC = explode(" ", $bcc_email);
  137. foreach ($indiBCC as $key => $value) {
  138. $mail->addBCC($value);
  139. $example_code .= "\n\$mail->addBCC(\"" . addslashes($value) . "\");";
  140. }
  141. }
  142. if ($_POST['cc_Email'] != '') {
  143. $indiCC = explode(" ", $cc_Email);
  144. foreach ($indiCC as $key => $value) {
  145. $mail->addCC($value);
  146. $example_code .= "\n\$mail->addCC(\"" . addslashes($value) . "\");";
  147. }
  148. }
  149. } catch (phpmailerException $e) { //Catch all kinds of bad addressing
  150. throw new phpmailerAppException($e->getMessage());
  151. }
  152. $mail->Subject = $subject . ' (PHPMailer test using ' . strtoupper($test_type) . ')';
  153. $example_code .= "\n\$mail->Subject = \"" . addslashes($subject) .
  154. ' (PHPMailer test using ' . addslashes(strtoupper($test_type)) . ')";';
  155. if ($_POST['Message'] == '') {
  156. $body = file_get_contents('contents.html');
  157. } else {
  158. $body = $message;
  159. }
  160. $example_code .= "\n\$body = <<<'EOT'\n$body\nEOT;";
  161. $mail->WordWrap = 78; // set word wrap to the RFC2822 limit
  162. $mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
  163. $example_code .= "\n\$mail->WordWrap = 78;";
  164. $example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images";
  165. $mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name
  166. $mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
  167. $example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," .
  168. "'phpmailer_mini.png'); // optional name";
  169. $example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name";
  170. $example_code .= "\n\ntry {";
  171. $example_code .= "\n \$mail->send();";
  172. $example_code .= "\n \$results_messages[] = \"Message has been sent using " .
  173. addslashes(strtoupper($test_type)) . "\";";
  174. $example_code .= "\n}";
  175. $example_code .= "\ncatch (phpmailerException \$e) {";
  176. $example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());";
  177. $example_code .= "\n}";
  178. try {
  179. $mail->send();
  180. $results_messages[] = "Message has been sent using " . strtoupper($test_type);
  181. } catch (phpmailerException $e) {
  182. throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage());
  183. }
  184. }
  185. } catch (phpmailerAppException $e) {
  186. $results_messages[] = $e->errorMessage();
  187. }
  188. $example_code .= "\n}";
  189. $example_code .= "\ncatch (phpmailerAppException \$e) {";
  190. $example_code .= "\n \$results_messages[] = \$e->errorMessage();";
  191. $example_code .= "\n}";
  192. $example_code .= "\n\nif (count(\$results_messages) > 0) {";
  193. $example_code .= "\n echo \"<h2>Run results</h2>\\n\";";
  194. $example_code .= "\n echo \"<ul>\\n\";";
  195. $example_code .= "\nforeach (\$results_messages as \$result) {";
  196. $example_code .= "\n echo \"<li>\$result</li>\\n\";";
  197. $example_code .= "\n}";
  198. $example_code .= "\necho \"</ul>\\n\";";
  199. $example_code .= "\n}";
  200. ?><!DOCTYPE html>
  201. <html>
  202. <head>
  203. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  204. <title>PHPMailer Test Page</title>
  205. <script type="text/javascript" src="scripts/shCore.js"></script>
  206. <script type="text/javascript" src="scripts/shBrushPhp.js"></script>
  207. <link type="text/css" rel="stylesheet" href="styles/shCore.css">
  208. <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css">
  209. <style>
  210. body {
  211. font-family: Arial, Helvetica, sans-serif;
  212. font-size: 1em;
  213. padding: 1em;
  214. }
  215. table {
  216. margin: 0 auto;
  217. border-spacing: 0;
  218. border-collapse: collapse;
  219. }
  220. table.column {
  221. border-collapse: collapse;
  222. background-color: #FFFFFF;
  223. padding: 0.5em;
  224. width: 35em;
  225. }
  226. td {
  227. font-size: 1em;
  228. padding: 0.1em 0.25em;
  229. -moz-border-radius: 1em;
  230. -webkit-border-radius: 1em;
  231. border-radius: 1em;
  232. }
  233. td.colleft {
  234. text-align: right;
  235. width: 35%;
  236. }
  237. td.colrite {
  238. text-align: left;
  239. width: 65%;
  240. }
  241. fieldset {
  242. padding: 1em 1em 1em 1em;
  243. margin: 0 2em;
  244. border-radius: 1.5em;
  245. -webkit-border-radius: 1em;
  246. -moz-border-radius: 1em;
  247. }
  248. fieldset.inner {
  249. width: 40%;
  250. }
  251. fieldset:hover, tr:hover {
  252. background-color: #fafafa;
  253. }
  254. legend {
  255. font-weight: bold;
  256. font-size: 1.1em;
  257. }
  258. div.column-left {
  259. float: left;
  260. width: 45em;
  261. height: 31em;
  262. }
  263. div.column-right {
  264. display: inline;
  265. width: 45em;
  266. max-height: 31em;
  267. }
  268. input.radio {
  269. float: left;
  270. }
  271. div.radio {
  272. padding: 0.2em;
  273. }
  274. </style>
  275. <script>
  276. SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
  277. SyntaxHighlighter.all();
  278. function startAgain() {
  279. var post_params = {
  280. "From_Name": <?php echo JSString($from_name); ?>,
  281. "From_Email": <?php echo JSString($from_email); ?>,
  282. "To_Name": <?php echo JSString($to_name); ?>,
  283. "To_Email": <?php echo JSString($to_email); ?>,
  284. "cc_Email": <?php echo JSString($cc_email); ?>,
  285. "bcc_Email": <?php echo JSString($bcc_email); ?>,
  286. "Subject": <?php echo JSString($subject); ?>,
  287. "Message": <?php echo JSString($message); ?>,
  288. "test_type": <?php echo JSString($test_type); ?>,
  289. "smtp_debug": <?php echo JSString($smtp_debug); ?>,
  290. "smtp_server": <?php echo JSString($smtp_server); ?>,
  291. "smtp_port": <?php echo JSString($smtp_port); ?>,
  292. "smtp_secure": <?php echo JSString($smtp_secure); ?>,
  293. "smtp_authenticate": <?php echo JSString($smtp_authenticate); ?>,
  294. "authenticate_username": <?php echo JSString($authenticate_username); ?>,
  295. "authenticate_password": <?php echo JSString($authenticate_password); ?>
  296. };
  297. var resetForm = document.createElement("form");
  298. resetForm.setAttribute("method", "POST");
  299. resetForm.setAttribute("path", "index.php");
  300. for (var k in post_params) {
  301. var h = document.createElement("input");
  302. h.setAttribute("type", "hidden");
  303. h.setAttribute("name", k);
  304. h.setAttribute("value", post_params[k]);
  305. resetForm.appendChild(h);
  306. }
  307. document.body.appendChild(resetForm);
  308. resetForm.submit();
  309. }
  310. function showHideDiv(test, element_id) {
  311. var ops = {"smtp-options-table": "smtp"};
  312. if (test == ops[element_id]) {
  313. document.getElementById(element_id).style.display = "block";
  314. } else {
  315. document.getElementById(element_id).style.display = "none";
  316. }
  317. }
  318. </script>
  319. </head>
  320. <body>
  321. <?php
  322. if (version_compare(PHP_VERSION, '5.0.0', '<')) {
  323. echo 'Current PHP version: ' . phpversion() . "<br>";
  324. echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above.");
  325. }
  326. if (count($results_messages) > 0) {
  327. echo '<h2>Run results</h2>';
  328. echo '<ul>';
  329. foreach ($results_messages as $result) {
  330. echo "<li>$result</li>";
  331. }
  332. echo '</ul>';
  333. }
  334. if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") {
  335. echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n";
  336. echo "<br><span>Script:</span>\n";
  337. echo "<pre class=\"brush: php;\">\n";
  338. echo htmlentities($example_code);
  339. echo "\n</pre>\n";
  340. echo "\n<hr style=\"margin: 3em;\">\n";
  341. }
  342. ?>
  343. <form method="POST" enctype="multipart/form-data">
  344. <div>
  345. <div class="column-left">
  346. <fieldset>
  347. <legend>Mail Details</legend>
  348. <table border="1" class="column">
  349. <tr>
  350. <td class="colleft">
  351. <label for="From_Name"><strong>From</strong> Name</label>
  352. </td>
  353. <td class="colrite">
  354. <input type="text" id="From_Name" name="From_Name" value="<?php echo htmlentities($from_name); ?>"
  355. style="width:95%;" autofocus placeholder="Your Name">
  356. </td>
  357. </tr>
  358. <tr>
  359. <td class="colleft">
  360. <label for="From_Email"><strong>From</strong> Email Address</label>
  361. </td>
  362. <td class="colrite">
  363. <input type="text" id="From_Email" name="From_Email" value="<?php echo htmlentities($from_email); ?>"
  364. style="width:95%;" required placeholder="Your.Email@example.com">
  365. </td>
  366. </tr>
  367. <tr>
  368. <td class="colleft">
  369. <label for="To_Name"><strong>To</strong> Name</label>
  370. </td>
  371. <td class="colrite">
  372. <input type="text" id="To_Name" name="To_Name" value="<?php echo htmlentities($to_name); ?>"
  373. style="width:95%;" placeholder="Recipient's Name">
  374. </td>
  375. </tr>
  376. <tr>
  377. <td class="colleft">
  378. <label for="To_Email"><strong>To</strong> Email Address</label>
  379. </td>
  380. <td class="colrite">
  381. <input type="text" id="To_Email" name="To_Email" value="<?php echo htmlentities($to_email); ?>"
  382. style="width:95%;" required placeholder="Recipients.Email@example.com">
  383. </td>
  384. </tr>
  385. <tr>
  386. <td class="colleft">
  387. <label for="cc_Email"><strong>CC Recipients</strong><br>
  388. <small>(separate with commas)</small>
  389. </label>
  390. </td>
  391. <td class="colrite">
  392. <input type="text" id="cc_Email" name="cc_Email" value="<?php echo htmlentities($cc_email); ?>"
  393. style="width:95%;" placeholder="cc1@example.com, cc2@example.com">
  394. </td>
  395. </tr>
  396. <tr>
  397. <td class="colleft">
  398. <label for="bcc_Email"><strong>BCC Recipients</strong><br>
  399. <small>(separate with commas)</small>
  400. </label>
  401. </td>
  402. <td class="colrite">
  403. <input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo htmlentities($bcc_email); ?>"
  404. style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com">
  405. </td>
  406. </tr>
  407. <tr>
  408. <td class="colleft">
  409. <label for="Subject"><strong>Subject</strong></label>
  410. </td>
  411. <td class="colrite">
  412. <input type="text" name="Subject" id="Subject" value="<?php echo htmlentities($subject); ?>"
  413. style="width:95%;" placeholder="Email Subject">
  414. </td>
  415. </tr>
  416. <tr>
  417. <td class="colleft">
  418. <label for="Message"><strong>Message</strong><br>
  419. <small>If blank, will use content.html</small>
  420. </label>
  421. </td>
  422. <td class="colrite">
  423. <textarea name="Message" id="Message" style="width:95%;height:5em;"
  424. placeholder="Body of your email"><?php echo htmlentities($message); ?></textarea>
  425. </td>
  426. </tr>
  427. </table>
  428. <div style="margin:1em 0;">Test will include two attachments.</div>
  429. </fieldset>
  430. </div>
  431. <div class="column-right">
  432. <fieldset class="inner"> <!-- SELECT TYPE OF MAIL -->
  433. <legend>Mail Test Specs</legend>
  434. <table border="1" class="column">
  435. <tr>
  436. <td class="colleft">Test Type</td>
  437. <td class="colrite">
  438. <div class="radio">
  439. <label for="radio-mail">Mail()</label>
  440. <input class="radio" type="radio" name="test_type" value="mail" id="radio-mail"
  441. onclick="showHideDiv(this.value, 'smtp-options-table');"
  442. <?php echo ($test_type == 'mail') ? 'checked' : ''; ?>
  443. required>
  444. </div>
  445. <div class="radio">
  446. <label for="radio-sendmail">Sendmail</label>
  447. <input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail"
  448. onclick="showHideDiv(this.value, 'smtp-options-table');"
  449. <?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?>
  450. required>
  451. </div>
  452. <div class="radio">
  453. <label for="radio-qmail">Qmail</label>
  454. <input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail"
  455. onclick="showHideDiv(this.value, 'smtp-options-table');"
  456. <?php echo ($test_type == 'qmail') ? 'checked' : ''; ?>
  457. required>
  458. </div>
  459. <div class="radio">
  460. <label for="radio-smtp">SMTP</label>
  461. <input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp"
  462. onclick="showHideDiv(this.value, 'smtp-options-table');"
  463. <?php echo ($test_type == 'smtp') ? 'checked' : ''; ?>
  464. required>
  465. </div>
  466. </td>
  467. </tr>
  468. </table>
  469. <div id="smtp-options-table" style="margin:1em 0 0 0;
  470. <?php if ($test_type != 'smtp') {
  471. echo "display: none;";
  472. } ?>">
  473. <span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span>
  474. <table border="1" class="column">
  475. <tr>
  476. <td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td>
  477. <td class="colrite">
  478. <select size="1" id="smtp_debug" name="smtp_debug">
  479. <option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0">
  480. 0 - Disabled
  481. </option>
  482. <option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1">
  483. 1 - Client messages
  484. </option>
  485. <option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2">
  486. 2 - Client and server messages
  487. </option>
  488. </select>
  489. </td>
  490. </tr>
  491. <tr>
  492. <td class="colleft"><label for="smtp_server">SMTP Server</label></td>
  493. <td class="colrite">
  494. <input type="text" id="smtp_server" name="smtp_server"
  495. value="<?php echo htmlentities($smtp_server); ?>" style="width:95%;"
  496. placeholder="smtp.server.com">
  497. </td>
  498. </tr>
  499. <tr>
  500. <td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td>
  501. <td class="colrite">
  502. <input type="text" name="smtp_port" id="smtp_port" size="3"
  503. value="<?php echo htmlentities($smtp_port); ?>" placeholder="Port">
  504. </td>
  505. </tr>
  506. <tr>
  507. <td class="colleft"><label for="smtp_secure">SMTP Security</label></td>
  508. <td>
  509. <select size="1" name="smtp_secure" id="smtp_secure">
  510. <option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option>
  511. <option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option>
  512. <option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option>
  513. </select>
  514. </td>
  515. </tr>
  516. <tr>
  517. <td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td>
  518. <td class="colrite">
  519. <input type="checkbox" id="smtp-authenticate"
  520. name="smtp_authenticate"
  521. <?php if ($smtp_authenticate != '') {
  522. echo "checked";
  523. } ?>
  524. value="true">
  525. </td>
  526. </tr>
  527. <tr>
  528. <td class="colleft"><label for="authenticate_username">Authenticate Username</label></td>
  529. <td class="colrite">
  530. <input type="text" id="authenticate_username" name="authenticate_username"
  531. value="<?php echo htmlentities($authenticate_username); ?>" style="width:95%;"
  532. placeholder="SMTP Server Username">
  533. </td>
  534. </tr>
  535. <tr>
  536. <td class="colleft"><label for="authenticate_password">Authenticate Password</label></td>
  537. <td class="colrite">
  538. <input type="password" name="authenticate_password" id="authenticate_password"
  539. value="<?php echo htmlentities($authenticate_password); ?>" style="width:95%;"
  540. placeholder="SMTP Server Password">
  541. </td>
  542. </tr>
  543. </table>
  544. </div>
  545. </fieldset>
  546. </div>
  547. <br style="clear:both;">
  548. <div style="margin-left:2em; margin-bottom:5em; float:left;">
  549. <div style="margin-bottom: 1em; ">
  550. <input type="submit" value="Submit" name="submit">
  551. </div>
  552. <?php echo 'Current PHP version: ' . phpversion(); ?>
  553. </div>
  554. </div>
  555. </form>
  556. </body>
  557. </html>

Powered by TurnKey Linux.