HOME


Mini Shell 1.0
DIR: /proc/self/root/home/islapiiu/sites/thomas-gall/newsite/contact-form/
Upload File :
Current File : //proc/self/root/home/islapiiu/sites/thomas-gall/newsite/contact-form/send-email-old.php
<?php
//------------------------- INCLUDE CLASS FILES -------------------------
include_once(dirname(__FILE__) . '/../class/include.php');

//------------------------- IMPORTANT -------------------------

require_once "Mail.php";
date_default_timezone_set('Asia/Colombo');
$todayis = date("l, F j, Y, g:i a"); 
$site_link = "https://" . $_SERVER['HTTP_HOST'];

//----------------------- DISPLAY STRINGS ---------------------
$comany_name = "Gt Cabs & Tours Srilanka";
$website_name = "www.gtcabstourssrilanka.com";
$comConNumber = "+94 763 788 247";
$comEmail = "[email protected]";
$comOwner = "Gt Cabs & Tours Srilanka";
$customer_msg = 'Hello, and thank you for your interest in ' . $comany_name . '. We have received your enquiry, and we will get back to you as soon as possible.';

//----------------------- LOGO ---------------------------------


// ----------------------- POST VARIABLES --------------------------

$visitor_name = $_POST['visitor_name'];
$visitor_email = $_POST['visitor_email'];
$visitor_phone = $_POST['visitor_phone'];
$subject = $_POST['subject'];
$message = $_POST['message'];


//---------------------- SERVER WEBMAIL LOGIN ------------------------

$host = "sg1-ls7.a2hosting.com";
$username = "[email protected]"; 
$password = '~y]cu9v;~WYy}';

//------------------------ MAIL ESSENTIALS --------------------------------

$webmail = "[email protected]";
$visitorSubject = "Thank You " . $visitor_name . " - Gt Cabs & Tours Srilanka";
$companySubject = "Contact Enquiry - " . $visitor_name;

//----------------------CAPTCHACODE---------------------

session_start();

$response = array();

if ($_SESSION['CAPTCHACODE'] != $_POST['captchacode']) {

    $response['status'] = 'incorrect';

    $response['msg'] = 'Security Code is invalid';

    echo json_encode($response);

    exit();
}

include("mail-template.php");


$visitorHeaders = array('MIME-Version' => '1.0', 'Content-Type' => "text/html; charset=ISO-8859-1", 'From' => $webmail,
    'To' => $visitor_email,
    'Reply-To' => $comEmail,
    'Subject' => $visitorSubject);

$companyHeaders = array('MIME-Version' => '1.0', 'Content-Type' => "text/html; charset=ISO-8859-1", 'From' => $webmail,
    'To' => $webmail,
    'Reply-To' => $visitor_email,
    'Subject' => $companySubject);


$smtp = Mail::factory('smtp', array('host' => $host,
            'auth' => true,
            'username' => $username,
            'password' => $password));

$visitorMail = $smtp->send($visitor_email, $visitorHeaders, $visitor_message);
$companyMail = $smtp->send($webmail, $companyHeaders, $company_message);

if (PEAR::isError($visitorMail && $companyMail)) {

    $response['status'] = 'correct';

    $response['msg'] = $mail->getMessage();

//"Your message has not been sent"

    echo json_encode($response);

    exit();
} else {
    $response['status'] = 'correct';

    $response['msg'] = "Your message has been sent successfully111";

//"Your message has been sent successfully"

    echo json_encode($response);

    exit();
}