Advertisement
pbowers

UserSpice patch - improvements on email_test.php

Aug 25th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.39 KB | None | 0 0
  1. diff -bcr ../UserSpice41/users/email_test.php ./users/email_test.php
  2. *** ../UserSpice41/users/email_test.php 2016-08-15 15:51:50.062520500 +0200
  3. --- ./users/email_test.php  2016-08-25 14:59:55.767586500 +0200
  4. ***************
  5. *** 17,22 ****
  6. --- 17,30 ----
  7.   You should have received a copy of the GNU General Public License
  8.   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  9.   */
  10. +
  11. + /* DEVELOPER NOTE:
  12. +    If you are having difficulty with your email configuration, go to
  13. +    users/helpers/helpers.php (around line 114) and set $mail->SMTPDebug
  14. +    to a non-zero value. This is a development-platform-ONLY setting - be
  15. +    sure to set it back to zero (or leave it unset) on any live platform -
  16. +    otherwise you would open significant security holes.
  17. + */
  18.   ?>
  19.   <?php require_once 'init.php'; ?>
  20.   <?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
  21. ***************
  22. *** 27,46 ****
  23.     Redirect::to('account.php');
  24.   }
  25.     ?>
  26. - <?php
  27. - //PHP Goes Here!
  28. -
  29. - $query = $db->query("SELECT * FROM email");
  30. - $results = $query->first();
  31. -
  32. - if(!empty($_POST)){
  33. -   $to = $_POST['test_acct'];
  34. -   $subject = 'Testing Your Email Settings!';
  35. -   $body = 'This is the body of your test email';
  36. -   $mail_result=email($to,$subject,$body);
  37. - }
  38. -
  39. - ?>
  40.   <div id="page-wrapper">
  41.  
  42.     <div class="container-fluid">
  43. --- 35,40 ----
  44. ***************
  45. *** 49,59 ****
  46.       <div class="row">
  47.         <div class="col-sm-12">
  48.  
  49. -         <!-- Left Column -->
  50. -         <div class="class col-sm-4"></div>
  51. -
  52.           <!-- Main Center Column -->
  53. !         <div class="class col-sm-3">
  54.             <!-- Content Goes Here. Class width can be adjusted -->
  55.             <h1>
  56.               Test your email settings.
  57. --- 43,50 ----
  58.       <div class="row">
  59.         <div class="col-sm-12">
  60.  
  61.           <!-- Main Center Column -->
  62. !         <div class="class col-xs-12 col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6">
  63.             <!-- Content Goes Here. Class width can be adjusted -->
  64.             <h1>
  65.               Test your email settings.
  66. ***************
  67. *** 61,89 ****
  68.             It's a good idea to test to make sure you can actually receive system emails before forcing your users to verify theirs. <br><br>
  69.             <?php
  70.             if (!empty($_POST)){
  71.                 if($mail_result){
  72. !                   echo 'Mail sent successfully<br/>';
  73.                 }else{
  74. !                   echo 'Mail ERROR<br/>';
  75.                 }
  76. -
  77.             }
  78. -        
  79.           ?>
  80.          
  81.           <form class="" name="test_email" action="email_test.php" method="post">
  82.               <label>Send test to (Ideally different than your from address):
  83.                 <input required size='50' class='form-control' type='text' name='test_acct' value='' /></label>
  84.  
  85. !               <label>&nbsp;</label>
  86.                 <input class='btn btn-primary' type='submit' value='Send A Test Email' class='submit' />
  87.             </form>
  88.  
  89.             <!-- End of main content section
  90.           </div>
  91.  
  92. -
  93. -         <div class="class col-sm-1"></div>
  94.         </div>
  95.       </div>
  96.  
  97. --- 52,86 ----
  98.             It's a good idea to test to make sure you can actually receive system emails before forcing your users to verify theirs. <br><br>
  99.             <?php
  100.                 if (!empty($_POST)){
  101. +             /* these appear to be unused
  102. +             $query = $db->query("SELECT * FROM email");
  103. +             $results = $query->first();
  104. +             */
  105. +
  106. +               $to = $_POST['test_acct'];
  107. +               $subject = 'Testing Your Email Settings!';
  108. +               $body = 'This is the body of your test email';
  109. +               $mail_result=email($to,$subject,$body);
  110. +
  111.                     if($mail_result){
  112. !                       echo '<div class="alert alert-success" role="alert">Mail sent successfully</div><br/>';
  113.                     }else{
  114. !                       echo '<div class="alert alert-danger" role="alert">Mail ERROR</div><br/>';
  115.                     }
  116.                 }
  117.               ?>
  118.  
  119.           <form class="" name="test_email" action="email_test.php" method="post">
  120.               <label>Send test to (Ideally different than your from address):
  121.                 <input required size='50' class='form-control' type='text' name='test_acct' value='' /></label>
  122.  
  123. !               <label>&nbsp;</label><br />
  124.                 <input class='btn btn-primary' type='submit' value='Send A Test Email' class='submit' />
  125.             </form>
  126.  
  127.             <!-- End of main content section
  128.           </div>
  129.  
  130.         </div>
  131.       </div>
  132.  
  133. diff -bcr ../UserSpice41/users/helpers/helpers.php ./users/helpers/helpers.php
  134. *** ../UserSpice41/users/helpers/helpers.php    2016-08-15 15:51:52.583452900 +0200
  135. --- ./users/helpers/helpers.php 2016-08-25 14:44:05.035763700 +0200
  136. ***************
  137. *** 110,116 ****
  138.  
  139.     $mail = new PHPMailer;
  140.  
  141. !   //$mail->SMTPDebug = 3;                               // Enable verbose debug output
  142.  
  143.     $mail->isSMTP();                                      // Set mailer to use SMTP
  144.     $mail->Host = $smtp_server;  // Specify main and backup SMTP servers
  145. --- 110,119 ----
  146.  
  147.     $mail = new PHPMailer;
  148.  
  149. ! /*
  150. !   $mail->SMTPDebug = 3;                               // Enable verbose debug output
  151. !   $mail->Debugoutput = 'html';                        // debug output displays well in html
  152. ! */
  153.  
  154.     $mail->isSMTP();                                      // Set mailer to use SMTP
  155.     $mail->Host = $smtp_server;  // Specify main and backup SMTP servers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement