‰PNG

   IHDR         ôxÔú   sBIT|dˆ   	pHYs  Ä  Ä•+   tEXtSoftware www.inkscape.org›î<  ,àtEXtComment 
<?php

//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Required files
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';

//Check if the form is submitted
if (isset($_POST["send"])) {

    $mail = new PHPMailer(true); // Passing `true` enables exceptions

    try {
        //Server settings
        $mail->isSMTP();                              //Send using SMTP
        $mail->Host       = 'smtp.titan.email';       //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                     //Enable SMTP authentication
        $mail->Username   = 'support@richardmooresmith.org'; //SMTP username
        $mail->Password   = 'Ocrke.TRoup1';           //SMTP password
        $mail->SMTPSecure = 'ssl';                    //Enable implicit SSL encryption
        $mail->Port       = 465;                      //TCP port to connect to

        //Recipients
        $mail->setFrom($_POST["email"], $_POST["name"]); // Sender email and name
        $mail->addAddress('alikaalbrightprime@gmail.com'); // Add a recipient email  
        $mail->addReplyTo($_POST["email"], $_POST["name"]); // Reply to sender email

        //Content
        $mail->isHTML(true);                          //Set email format to HTML
        $mail->Subject = $_POST["subject"];           //Email subject
        $mail->Body    = $_POST["message"];           //Email body

        //Send email and display success alert
        $mail->send();
        echo
        "<script> 
            alert('Message was sent successfully!');
            document.location.href = 'index.php';
        </script>";

    } catch (Exception $e) {
        //Display error alert
        echo
        "<script> 
            alert('Message could not be sent. Mailer Error: {$mail->ErrorInfo}');
            document.location.href = 'index.php';
        </script>";
    }
}
?>
