<?php
header("Access-Control-Allow-Origin: *");
 
$to = 'business.support@compu-stor.com.au';
// $to = 'sajan@propagate.com.au';
$subject = 'New Request ' . $_POST['name'] . ' ' . isset($_POST['landing-page']) ? $_POST['landing-page'] : '';
if (isset($_POST['landing-page'])) {
    $headers = "From: " . strip_tags($_POST['email']) . "\r\n";
} else {
    $headers = "From: " . strip_tags($_POST['email']) . "\r\n";
}

// #$headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "Bcc: team@propagate.com.au\r\n";

$message = '<html><body>';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Full Name:</strong> </td><td>" . strip_tags($_POST['name']) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($_POST['email']) . "</td></tr>";
$message .= "<tr><td><strong>Phone:</strong> </td><td>" . strip_tags($_POST['phone']) . "</td></tr>";
$message .= "<tr><td><strong>Company:</strong> </td><td>" . strip_tags($_POST['company']) . "</td></tr>";
$message .= "<tr><td><strong>Address:</strong> </td><td>" . strip_tags($_POST['state']) . strip_tags($_POST['suburb']) . "</td></tr>";

$message .= "</table>";
$message .= "</body></html>";

$success = mail($to, $subject, $message, $headers);
#wp_mail( $to, $subject, $message, $headers );

echo $thank_you;
exit;
