#!/usr/bin/php
<?php

use PHPMailer\PHPMailer\PHPMailer;
use Exception\Exception\Exception;

/* Exception class. */
require '/usr/local/share/php/PHPMailer/src/Exception.php';

/* The main PHPMailer class. */
require '/usr/local/share/php/PHPMailer/src/PHPMailer.php';

/* SMTP class, needed if you want to use SMTP. */
require '/usr/local/share/php/PHPMailer/src/SMTP.php';

$mail = new PHPMailer(true);
$mail->IsSMTP(true);
$mail->CharSet = 'UTF-8';
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = "pjamesnorris25@gmail.com";
$mail->Password = "shnnAIA-04";
$mail->SMTPSecure = 'tls';
$mail->Port = 587;

/* Open the try/catch block. */
try {
   /* Set the mail sender. */
   $mail->setFrom('pjamesnorris25@gmail.com', 'P James Norris');

   /* Add a recipient. */
   $mail->addAddress('pjamesnorris25@gmail.com', 'P James Norris');

   /* Set the subject. */
   $mail->Subject = 'from 192.158.0.15';

   /* Set the mail message body. */
   $mail->Body = 'There is a great disturbance in the Force.';

   /* Enable SMTP debug output. */
//   $mail->SMTPDebug = 4;

   /* Finally send the mail. */
   if(!$mail->Send()) 
   {
	echo 'Message could not be sent.';
    	echo 'Mailer Error: ' . $mail->ErrorInfo;
    	exit;
   } // if(!$mail->Send())

}
catch (Exception $e)
{
   /* PHPMailer exception. */
   echo $e->errorMessage();
}
catch (\Exception $e)
{
   /* PHP exception (note the backslash to select the global namespace Exception class). */
   echo $e->getMessage();
}


?>