<?php

include("../config.php");
session_start();


	$user = intval($_POST["user"]);
	$email = $_POST["email"];
	$title = $_POST["title"];
	$msgBody = $_POST["msg"];

		
	$stmt=$pdo->prepare("SELECT * FROM users WHERE userid=:userid");
	$stmt->bindParam(":userid", $user, PDO::PARAM_STR);
	$stmt->execute();
	$userInfo = $stmt->fetch();
	$siteUserImg = (!empty($userInfo["profilepix"]) ? "http://www.sujfix.com/img/users/".$userInfo["profilepix"]: "http://www.sujfix.com/img/avatar.png");
	
	


//error_reporting(0);

$msg = '
<html><head>

	
    <style type="text/css">
        @media screen {
            @font-face {
                font-family: "Lato";
                font-style: normal;
                font-weight: 400;
                src: local("Lato Regular"), local("Lato-Regular"), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format("woff");
            }

            @font-face {
                font-family: "Lato";
                font-style: normal;
                font-weight: 700;
                src: local("Lato Bold"), local("Lato-Bold"), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format("woff");
            }

            @font-face {
                font-family: "Lato";
                font-style: italic;
                font-weight: 400;
                src: local("Lato Italic"), local("Lato-Italic"), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format("woff");
            }

            @font-face {
                font-family: "Lato";
                font-style: italic;
                font-weight: 700;
                src: local("Lato Bold Italic"), local("Lato-BoldItalic"), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format("woff");
            }
        }


        body {
            height: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
			font-size:16px!important;
			color:#868585;
			background:#f9f9f9;
			font-family: "Lato", Helvetica, Arial, sans-serif;
        }



        /* MOBILE STYLES */
        @media screen and (max-width:600px) {
            h1 {
                font-size: 32px !important;
                line-height: 32px !important;
            }
        }

        /* ANDROID CENTER FIX */
        div[style*="margin: 16px 0;"] {
            margin: 0 !important;
        }
	
	
		.mailbdy{
			font-size:16px!important;
			margin:auto;
			max-width:700px;
			margin-top:10px;
			
		}
		a{
			text-decoration:none;
			color:#174d78!important;
		}
    </style>
</head>

<body>


	
              <div class="mailbdy">
			  
              <div style="text-align:center!important; border-radius:10px; border:1px solid #ccc5c5; padding-bottom:20px; background:#fff;">
			  
		<div style="background:#365a78; margin-bottom:10px;border-radius:10px 10px 0px 0px;font-size:30px; font-weight: 600; color:#fff; padding:10px;">
			  <span style="font-family:comic sans ms; color:#ffb56a;font-size:45px;">S</span>wiss <div style="background:#365a78; margin-bottom:10px;border-radius:10px 10px 0px 0px;font-size:30px; font-weight: 600; color:#fff; padding:10px;">
			  <span style="font-family:comic sans ms; color:#ffb56a;font-size:45px;">W</span>ealth <div style="background:#365a78; margin-bottom:10px;border-radius:10px 10px 0px 0px;font-size:30px; font-weight: 600; color:#fff; padding:10px;">
			  <span style="font-family:comic sans ms; color:#ffb56a;font-size:45px;">P</span>ro
			  </div>
           


		<center>
		<img alter="Profile Photo" src=" '.$siteUserImg.' " style="margin-left: auto;width: 70px;height: 70px;border-radius: 50%;border: 2px solid #57739b;">
		</center><br>
		<div style="color:#405972; font-size:16px; margin-bottom:10px;text-align:center"><b>'.$userInfo["fullName"].'
		</b></div>
		<div style="height: 0;border-color:#dadee5!important;margin: .5rem 0;overflow: hidden;border-top: 1px solid #f7f7f7;"></div>

							
			<br>							  
           <div align="left" style="padding: 0px 10px 0px 10px; color: #666666; line-height:1.5;">
           

		  '. $msgBody .'

				
			<p><br><br>
		  
		   
		   
		   
		   
		   
		   
		   <div style="height: 0;border-color:#dadee5!important;margin: .5rem 0;overflow: hidden;border-top: 1px solid #f7f7f7;"></div>
		   <div style="margin:12px 22px;font-size:17px;color:#326ca9;">Our Plan</div>
			<div style="height: 0;border-color:#dadee5!important;margin: .5rem 0;overflow: hidden;border-top: 1px solid #f7f7f7;"></div>

				  <div style="display:flex;margin:5px;justify-content:space-evenly;">
				  
				  <div style="text-align:center;background: #ebebeb;margin: 5px;border: 1px solid #d1cfc4;width: 45%;border-radius: 10px;">
				  <div style="box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); -webkit-box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); background:#fda234;padding:10px;border-radius:10px 10px 0 0;">
				  <h4 style="font-size:18px;margin-bottom:0px;margin-top:0px;font-weight:550;">Plan 1</h4>
					<text style="font-weight:550;color:#fff;text-shadow: 0.1em 0.1em 0.1em #856565;">$100 - $999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  4% for 3days</div>
				  </div>
				  
				  <div style="text-align:center;background: #ebebeb;margin: 5px;border: 1px solid #d1cfc4;width: 45%;border-radius: 10px;">
				   <div style="box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); -webkit-box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); background:#fda234;padding:10px;border-radius:10px 10px 0 0;">
				  <h4 style="font-size:18px;margin-bottom:0px;margin-top:0px;font-weight:550;">Plan 2</h4>
					<text style="font-weight:550;color:#fff;text-shadow: 0.1em 0.1em 0.1em #856565;">$1,000 - $4,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  6% for 3days</div>
				  </div>
				  
				  </div>
				  
				   <div style="display:flex;margin:5px;justify-content:space-evenly;">
				  
				  <div style="text-align:center;background: #ebebeb;margin: 5px;border: 1px solid #d1cfc4;width: 45%;border-radius: 10px;">
				   <div style="box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); -webkit-box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); background:#fda234;padding:10px;border-radius:10px 10px 0 0;">
				 <h4 style="font-size:18px;margin-bottom:0px;margin-top:0px;font-weight:550;">Plan 3</h4>
					<text style="font-weight:550;color:#fff;text-shadow: 0.1em 0.1em 0.1em #856565;">$5,000 - $49,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  8% for 3days </div>
				  </div>
				  
				  <div style="text-align:center;background: #ebebeb;margin: 5px;border: 1px solid #d1cfc4;width: 45%;border-radius: 10px;">
				   <div style="box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); -webkit-box-shadow: 0 0 1px rgb(0 0 0 / 13%), 0 1px 3px rgb(0 0 0 / 20%); background:#fda234;padding:10px;border-radius:10px 10px 0 0;">
				  <h4 style="font-size:18px;margin-bottom:0px;margin-top:0px;font-weight:550;">Plan 4</h4>
					<text style="font-weight:550;color:#fff;text-shadow: 0.1em 0.1em 0.1em #856565;">$50,000 - $149,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  10% for 3days</div>
				  </div>
				  
				  </div>
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
                 
			</div> 
			<br>
            <div style="text-align:left; border-top:1px solid #ededed;font-size:14px; padding:10px;">
             </div>
			 
                   
				  
           		

		   
            </div>
					
			
						
		</div>


</body></html>

';


// 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 "../vendor/autoload.php";

// Base files 
//require "PHPMailer/src/Exception.php";
//require "PHPMailer/src/PHPMailer.php";
//require "PHPMailer/src/SMTP.php";

// create object of PHPMailer class with boolean parameter which sets/unsets exception.

$mail = new PHPMailer(true);                              



try {
    //Server settings
    //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
    $mail->isSMTP();                                            //Send using SMTP
	$mail->Host   = "server904.vebhost.com";                     //Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail->Username   = "info@secureswiss-wealth-pro.org";                     //SMTP username
    $mail->Password   = "Rydaman999$$&&";                               //SMTP password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail->Port   = 587;                                    //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
	
	
    //Recipients
    $mail->setFrom("info@secureswiss-wealth-pro.org", "admin");
    $mail->addAddress($email, $userInfo["fullName"]);     //Add a recipient
    //$mail->addAddress("ellen@example.com");               //Name is optional
    //$mail->addReplyTo("info@example.com", "Information");
    //$mail->addCC("cc@example.com");
    //$mail->addBCC("bcc@example.com");

    //Attachments
  //  $mail->addAttachment("/var/tmp/file.tar.gz");         //Add attachments
   // $mail->addAttachment("/tmp/image.jpg", "new.jpg");    //Optional name

    //Content
    $mail->isHTML(true);                                  //Set email format to HTML
    $mail->Subject = $title;
    $mail->Body    = $msg;
   // $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

    $mail->send();



		echo 1;



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



?>
