code_generator.phps 27 KB

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