code_generator.phps 27 KB

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