<?php use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer/Exception.php';
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
     $logo = "https://orangegroceries.com/img/logo.png";
    $logo_width = "100%";
    $logo_height = "";
    // All CSS
    // Body
    $body_title = "Orange Groceries";
    $width_of_mail_body = "80%"; // Please write in % percentage for better view...
    $padding_of_mail_body = "20px";
    $body_background_color = "";
    $body_text_color = "";
    // Header
    $header_background_color = "";
    $header_text_color = "";
    $header_font_size = "";
    $header_font_family = "";
    // Footer
    $footer_background_color = "#2F3B59";
    $footer_text_color = "white";
    $footer_font_size = "10px";
    $footer_font_family = "monospace";
    // Button
    $button_background_color = "#4db7fe";
    $button_text_color = "white";
    $button_font_size = "20px";
    $button_font_family = "monospace";
    $button_padding = "15px";
    $button_border_radius = "10px";
    // Highlight
    $highlight_color = "#4db7fe";
    $highlight_font_size = "25px";
    $highlight_font_family = "monospace";
    // Heading
    $heading_color = "#4db7fe";
    $heading_font_size = "25px";
    $heading_font_family = "monospace";
    // Paragraph
    $paragraph_color = "";
    $paragraph_font_size = "14px";
    $paragraph_font_family = "monospace";    

     $sqqq="select * from user_profile where id=".$user_id;
    $sql1=mysqli_query($conn, $sqqq);
    $row1=mysqli_fetch_array($sql1);
    $total_price = $res_pt['total_price'];
    $email = $row1['email'];
    $name = $row1['fname'];
    $date = date("d-m-Y");
    $from_team = "Orange Groceries";
    $from_website = "https://orangegroceries.com/index.php";
    $to = $email;
    $message = "
                <html>
                    <head>
                        <title>$body_title</title>
                    </head>
                    <body style='background-color: $body_background_color; color: $body_text_color;'>
                        <center>
                            <div style='width: $width_of_mail_body; padding: $padding_of_mail_body;' >
                                <br/><br/>
                                <p style='color: $paragraph_color; font-size: $paragraph_font_size; font-family: $paragraph_font_family;'> 
                                    <span style='color: $highlight_color; font-size: $highlight_font_size; font-family: $highlight_font_family;'>
                                        Hi $name,
                                    </span> 
                                    <br/>
                                    Welcome to <span style='color: $highlight_color; font-size: $highlight_font_size; font-family: $highlight_font_family;'> $from_team</span>, Your Order Placed with RS.$total_price , Pay On Delivery <br/> Thankyou!!!
                                </p>
                                <br/><br/><br/><br/>
                                <div style='width: 100%; background-color: $footer_background_color; color: $footer_text_color; font-family: $footer_font_family; font-size: $footer_font_size; padding-top: 30px; padding-bottom: 30px;'>
                                    Thanks And Regards
                                    <br/>
                                    <span style='color: white;'>$from_website</span>
                                </div>
                            </div>
                        </center>
                    </body>
                </html>";
$email = new PHPMailer();
$email->Body      =  ($message);
$email->SetFrom('support@orangegroceries.com', 'Orange Groceries'); //Name is optional
$email->Subject   ="Order Placed With Orange Groceries";
$email->IsHTML(true);
$email->Body      =  ($message);
$email->AddAddress($to);
   if (! $email->Send()) {
       echo "Problem in sending email!";
         echo "Mailer Error: " . $email->ErrorInfo;

    } else {
   $message = "
                <html>
                    <head>
                        <title>$body_title</title>
                    </head>
                    <body style='background-color: $body_background_color; color: $body_text_color;'>
                        <center>
                            <div style='width: $width_of_mail_body; padding: $padding_of_mail_body;' >
                                <br/><br/>
                                <p style='color: $paragraph_color; font-size: $paragraph_font_size; font-family: $paragraph_font_family;'> 
                                    <span style='color: $highlight_color; font-size: $highlight_font_size; font-family: $highlight_font_family;'>
                                        Hi Team,
                                    </span> 
                                    <br/>
                                    Order Placed By <span style='color: $highlight_color; font-size: $highlight_font_size; font-family: $highlight_font_family;'> $name</span>, with RS.$total_price , Payment method Is Cash On Delivery ..<br/> !!!
                                </p>
                            </div>
                        </center>
                    </body>
                </html>";
$email = new PHPMailer();
$email->Body      =  ($message);
$email->SetFrom('support@orangegroceries.com', 'Orange Groceries'); //Name is optional
$email->Subject   = "Order Placed By" .$name ;
$email->IsHTML(true);
$email->Body      =  ($message);
$email->AddAddress('support@orangegroceries.com' );
   if (! $email->Send()) {
       echo "Problem in sending email!";
         echo "Mailer Error: " . $mail->ErrorInfo;

    } else {
               echo "email sended!";

    }
}


?>