Since a week ago, WordPress stopped to send normal emails upon new events like new user registration, new comments, and sucuri logs.
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.
But i have custom pages (Report and Request) that depends on default WordPress PHP mailer
so, how i integrate WP Mail SMTP inside these pages
here is an example of the report page
<?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->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"] ); }
if ($resp != null && $resp->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->Host = "localhost";
$mail->From = $rmailsend;
$mail->FromName = __( "New Report", "demotheme" );
$mail->Subject = $_POST['videos'];
$mail->AddAddress($rmailsend);
if ($vname != "") {
$mail->AddAttachment($vtemp, $vname); }
$body = "body"
and here is the "class.phpmailer.php" file