<?php
use PHPMailer\PHPMailer\PHPMailer;

// Load PHPMailer
require 'PHPMailer.php';
require 'SMTP.php';
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email'])) {
    date_default_timezone_set('Etc/UTC');

    $mail = new PHPMailer(true);

    try {
        // Server settings
        $mail->isSMTP();
        $mail->Host = 'smtp.sendgrid.net';
		// $mail->SMTPDebug = 2;
        $mail->SMTPAuth = true;
        $mail->Username = 'apikey';
        $mail->Password = "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";

        $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
        if (!$email) {
            throw new Exception("Invalid email address.");
        }

        $mail->setFrom('sales@tmcards.com', 'All Types of Playing Cards');
        $mail->addAddress('sales@tmcards.com', 'TMCARDS Sales');
        $mail->addReplyTo($email, $_POST['name'] ?? 'Customer');

        $mail->Subject = 'Quote Form Submission';
        $mail->isHTML(false);

        // Sanitizing user input
        $fields = [
            'fname' => 'First Name',
            'lname' => 'Last Name',
            'email' => 'Email',
            'telno' => 'Phone',
            'cname' => 'Company Name',
            'city' => 'City',
            'zipcode' => 'Zip Code',
            'state' => 'State',
            'country' => 'Country',
            'quantity' => 'Quantity',
            'size_specifications' => 'Specifications',
            'cards_per_deck' => 'Cards per Deck',
            'colors_to_be_printed_on_front' => 'Front Colors',
            'colors_to_be_printed_on_back' => 'Back Colors',
            'mode_of_delivery' => 'Mode of Delivery',
            'delivery_time' => 'Delivery Time',
        ];

        $body = "";
        foreach ($fields as $field => $label) {
            if (!empty($_POST[$field])) {
                $body .= "$label: " . htmlspecialchars($_POST[$field]) . "\n";
            }
        }

        $mail->Body = $body;

        if ($mail->send()) {
            // echo "Message sent successfully!";
        } else {
            throw new Exception("Failed to send email.");
        }
    } catch (Exception $e) {
        error_log("Mail Error: " . $e->getMessage());
        echo "Error: " . $e->getMessage();
    }
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head prefix="http://ogp.me/ns/website#">
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>All Types of playing cards</title>
		<meta name="keywords" content="Promotional Playing Cards Manufacturer, promotional playing cards, business playing cards, photo playing cards, logo playing card, custom logo playing cards, buy Promotional Playing Cards online, customized Promotional Playing Cards for sale" />
        <meta name="description" content="Print your own card deck in the custom or personalized Promotional Playing Cards way at the lowest rate. We create photo playing cards, logo playing card, etc." />
		<link rel="canonical" href="http://www.designerplayingcards.com/promotional-playing-cards.php" />
		<META name="ROBOTS" content="index, follow">
		<link rel="alternate" type="application/rss+xml" href="rss.xml" title="RSS feed for My Page">
		<!--og tag--> <meta property="og:type" content="product">
		<meta property="og:title" content="Promotional Playing Cards Manufacturer company in Mumbai">
		<meta property="og:site_name" content="All Types of Playing Cards">
		<meta property="og:url" content="http://www.designerplayingcards.com/promotional-playing-cards.php">
		<meta property="og:description" content="Print your own card deck in the custom or personalized Promotional Playing Cards way at the lowest rate. We create photo playing cards, logo playing card, etc.">
		<meta property="og:keywords" content="Promotional Playing Cards Manufacturer, promotional playing cards, business playing cards, photo playing cards, logo playing card, custom logo playing cards, buy Promotional Playing Cards online, customized Promotional Playing Cards for sale"/>
		<meta property="product:condition" content="new">
		<meta property="product:availability" content="in stock">
		<meta property="og:locale" content="en_US"/>
		<meta property="og:image" content="images/Custom-Promotional-Playing-Cards.jpg"/>
		<meta property="og:image:type" content="image/jpeg" />
		<meta property="og:image" content="images/brand-promotional-playing-cards.jpg"/>
		<meta property="og:image:type" content="image/jpeg" />
		<!--twitter tag--> <meta name="twitter:card" content="product">
		<meta name="twitter:site" content="@ATPCSM">
		<meta name="twitter:title" content="Promotional Playing Cards Manufacturer company in Mumbai">
		<meta name="twitter:description" content="Print your own card deck in the custom or personalized Promotional Playing Cards way at the lowest rate. We create photo playing cards, logo playing card, etc.">
		<meta name="twitter:image" content="images/brand-promotional-playing-cards.jpg" />
		<!--Yandex.Metrika counter-<script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter40316140 = new Ya.Metrika({ id:40316140, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true, trackHash:true, ecommerce:"dataLayer" }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks"); </script> 
		<!--bootstrap--><link rel="stylesheet" href="css/bootstrap.min.css">	  
		<link rel="stylesheet" href="css/font-awesome.min.css">
		<link href="css/style1.css" rel="stylesheet" type="text/css" />
		<link href="css/responsive-style.css" rel="stylesheet" type="text/css" />
		<!-- jQuery (necessary JavaScript plugins) --> <script type='text/javascript' src="js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="js/bootstrap-3.1.1.min.js"></script>
		<?php include("include files/favicon.php") ?>
	</head>
    <body itemscope itemtype="http://schema.org/Organization">
		<?php include_once("analyticstracking.php") ?>
		<?php include("include files/header.php");?>
		<?php include("include files/navigation.php");?>
		<!--breadcrumb--><div id='location'><div id="BannerAndNavigatorHtmlBlock_StoreNavigator_pnNavigator" itemscope=""  itemtype="http://schema.org/BreadcrumbList" class="btn-group btn-breadcrumb"><span class="btn btn-success" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="/"><span class="glyphicon glyphicon-home" itemprop="name"></span></a><span itemprop="position" content="1"></span></span></span><span class="btn btn-success" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">Promotional Playing Cards</span><span itemprop="position" content="2"></span></span></div></div>
		<!--Main Content--><div class="wrapper" itemscope itemtype="http://schema.org/Product"><div>&nbsp;</div><div class="container"><div class="well">
		
		<h1>
<?php if (!empty($msg)) {
    echo "<h2>$msg</h2>";
} ?></h1>
		</div></div></div>
		<?php include("include files/footer.php");?>		
    </body>
</html>