code_generator.phps 26 KB

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