<?php

$base_url = "https://leadsmode.com";
$logo_link_title = "LEADSMODE";
$main_logo_link = "https://leadsmode.com/assets/img/newlogo.png";
$logo_alt = "LEADSMODE";

$firstName = $_POST['fname'];
$lastName  = $_POST['lname'];
$email     = $_POST['email'];
$phone     = $_POST['phone'];
$request   = $_POST['request'];
$message   = $_POST['message'];


$msg = "<html><head></head><body style='margin: 0 auto; padding: 0; width: 1000px; font-family: sans-serif; '  bgcolor='#f9f9f9'>
  <table style='width: 800px; padding: 0px; margin: 0 auto; font-family: sans-serif;' bgcolor='#f9f9f9'>
    <tr>
      <td>
  <table style='margin: 0 auto; width: 600px; border-spacing: 0em; font-family: sans-serif;'  bgcolor='#ffffff'>
  <tbody>
  <tr>
  <th style='padding: 0; margin: 0;'>
      <a href='" . $base_url . "' target='_blank' rel='noopener'><img style='padding: 5px; margin: 10px auto; display: block; background-color: inherit;' title='" . $logo_link_title . "' src='" . $main_logo_link . "' alt='" . $logo_alt . "' width='100' /></a>

    <table style='min-height: 10px; margin: 0 auto; min-width: 100%; padding: 20px;' bgcolor='#ffffff'>
    <tbody>
    <tr>
    <th>
    <p style='color: #444444;  text-align: left; font-weight: 400;'><strong>Name: &nbsp;</strong> " . $firstName . " " . $lastName . " </p>
    <p style='color: #444444;  text-align: left; font-weight: 400;'><strong>Email:&nbsp;</strong>" . $email . "</p>
    <p style='color: #444444;  text-align: left; font-weight: 400;'><strong>Phone:&nbsp;</strong>" . $phone . "</p>
    <p style='color: #444444;  text-align: left; font-weight: 400;'><strong>Request:&nbsp;</strong>" . $request . "</p>
    <p style='color: #444444;  text-align: left; font-weight: 400;'><strong>Message:&nbsp;</strong>" . $message . "</p>
    </th>
    </tr>
    </tbody>
    </table></html>";


$email_cc = "sales@leadsmode.com";
$email_sent_from = "support@leadsmode.com";
$email_subject = "New Lead - $email from leadsmode.com";

$headers = "From: " . $email_sent_from . "" . "\r\n";
$headers .= "Bcc: " . $email_cc . "" . "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$diditsend = mail($email_cc, $email_subject, $msg, $headers);


$data = array("result" => "success");
echo json_encode($data);
