Shell File Manager

Current Path : /home/camscanae/public_html/support/mailer/
Upload File :
Current File : /home/camscanae/public_html/support/mailer/contact_us.php





<?php
$log_status = $_GET['log_status'];
//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\SMTP;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require 'autoload.php';
//get data from form
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
// preparing mail content
$messagecontent =

    "Good day  " . $name . "
<br>
Thank you for contacting us. You will receive a response as soon as possible. 
<br><br>
 " . $message;
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
    //Server settings
    //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
    $mail->isSMTP();                                            //Send using SMTP
    $mail->Host       = 'smtp.mailtrap.io';                     //Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail->Username   = '6d6214b2f4f19e';                     //SMTP username
    $mail->Password   = '44b7f2d8ebcc5e';                               //SMTP password
    // $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
    $mail->Port       = 2525;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
    //Recipients
    $mail->setFrom($_POST['email'], $_POST['name']);
    $mail->addAddress('[email protected] ', 'Support');     //Add a recipient


    //Content
    $mail->isHTML(true);                                  //Set email format to HTML
    $mail->Subject = $subject;
    $mail->Body    = $messagecontent;

    $mail->send();


    header("Location:../../contact.php?log_status=$log_status&success");

    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

Shell File Manager Version 1.1, Coded By Shell
Email: [email protected]