title: How to integerate WordPress Mail SMTP plugin to Report and Request custom page
body: <p>Since a week ago, WordPress stopped to send normal emails upon new events like new user registration, new comments, and sucuri logs.</p>
  
  <p>I tried everything but no luck, so i installed WP Mail SMTP to connect Gmail to my WordPress with Google API and it works fine.</p>
  
  <p>But i have custom pages (Report and Request) that depends on default WordPress PHP mailer</p>
  
  <p>so, how i integrate WP Mail SMTP inside these pages</p>
  
  <p>here is an example of the report page</p>
  
  <pre><code>&lt;?php 
  if($_GET['report']) { 
  require_once "form/captacha.php";
  $siteKey = get_option('pc_key');
  $secret = get_option('pv_key');
  $resp = null;
  $error = null;
  $reCaptcha = new ReCaptcha($secret);
  if ($_POST["g-recaptcha-response"]) {
  $resp = $reCaptcha-&gt;verifyResponse(
  $_SERVER["REMOTE_ADDR"],
  $_POST["g-recaptcha-response"] ); }
  if ($resp != null &amp;&amp; $resp-&gt;success) { 
  require("form/class.phpmailer.php");
  $msg = "";
  if ($_POST['action'] == "send") {
  $vname = $_FILES['arch']['name'];
  $vtemp = $_FILES['arch']['tmp_name'];
  $rmailsend = get_option('reportemail');
  $mail = new PHPMailer();
  $mail-&gt;Host = "localhost";
  $mail-&gt;From = $rmailsend;
  $mail-&gt;FromName = __( "New Report", "demotheme" );
  $mail-&gt;Subject = $_POST['videos'];
  $mail-&gt;AddAddress($rmailsend);
  if ($vname != "") {
  $mail-&gt;AddAttachment($vtemp, $vname); }
  $body = "body"
  </code></pre>
  
  <p>and here is the "class.phpmailer.php" file
  <a href="https://justpaste.it/683q8" rel="nofollow noreferrer">https://justpaste.it/683q8</a></p>