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

// require '../vendor/autoload.php';

class Hmailer {
    public $mail;
    function __construct($email){
// Instantiation and passing `true` enables exceptions
    $this->mail = new PHPMailer(true);
    //Server settings
    $this->mail->SMTPDebug = SMTP::DEBUG_OFF;                      //Enable verbose debug output SMTP::DEBUG_OFF
    $this->mail->isSMTP();                                            //Send using SMTP
    $this->mail->Host       = 'celticcapitalfund.com';                    // Set the SMTP server to send through
    $this->mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $this->mail->Username   = 'info@celticcapitalfund.com';                     // SMTP username
    $this->mail->Password   = 'Celtic@2024';  
    $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $this->mail->Port       = 587;                                    //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

    //Recipients
    $this->mail->setFrom('info@celticcapitalfund.com', 'Celtic Capital');
    $this->mail->addAddress($email);               
    $this->mail->addReplyTo('info@celticcapitalfund.com', 'Celtic Capital');
    }
    public function transaction_alert($tns_type, $acct_number, $amount, $sent_to,$currency){
    $this->mail->isHTML(true);                                 
    $this->mail->Subject = 'Transaction Alert('.substr($acct_number, 0, 4).'xxxx) Debit('.number_format($amount).') -  Celtic Capital';
    $this->mail->Body    = $this->transaction_alert_msg($tns_type,$amount,$sent_to,$currency);

    try{$this->mail->send();
        return true;
    } catch (Exception $e) {
        return false;
    }
    }
    public function OTP_alert($otp,$acct){
      $this->mail->isHTML(true);                                 
      $this->mail->Subject = 'OTP Login verification ('.substr($acct, 0, 4).'xxxx) -  Celtic Capital';
      $this->mail->Body    = $this->OTP_alert_msg($otp);
  
      try{$this->mail->send();
          return true;
      } catch (Exception $e) {
          return false;
      }
      }
      public function ch_mail($name){
        $this->mail->isHTML(true);                                 
        $this->mail->Subject = 'Changed Password -  Celtic Capital';
        $this->mail->Body    = $this->changePassword($name);
    
        try{$this->mail->send();
            return true;
        } catch (Exception $e) {
            return false;
        }
        }
        public function addpy_mail($name){
          $this->mail->isHTML(true);                                 
          $this->mail->Subject = 'New Withdrawal Method Added -  Celtic Capital';
          $this->mail->Body    = $this->addPaymentMethod($name);
      
          try{$this->mail->send();
              return true;
          } catch (Exception $e) {
              return false;
          }
          }
        public function Wdr_mail($name, $amount,$withdrawal_means){
          $this->mail->isHTML(true);                                 
          $this->mail->Subject = 'Funds Withdrawal Initiated -  Celtic Capital';
          $this->mail->Body    = $this->newWithdrawal($name, $amount,$withdrawal_means);
      
          try{$this->mail->send();
              return true;
          } catch (Exception $e) {
              return false;
          }
          }
          public function inv_mail($name, $payref,$coinamt,$invplan){
            $this->mail->isHTML(true);                                 
            $this->mail->Subject = 'New Investment -  Celtic Capital';
            $this->mail->Body    = $this->newInvestment($name, $payref,$coinamt,$invplan);
        
            try{$this->mail->send();
                return true;
            } catch (Exception $e) {
                return false;
            }
            }
   public function OTP_alert_msg($otp){
       return '<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title></title><link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<style>body,html{margin:0 auto!important;padding:0!important;height:100%!important;width:100%!important;background:#f1f1f1}*{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}div[style*="margin: 16px 0"]{margin:0!important}table,td{mso-table-lspace:0!important;mso-table-rspace:0!important}table{border-spacing:0!important;border-collapse:collapse!important;table-layout:fixed!important;margin:0 auto!important}img{-ms-interpolation-mode:bicubic}a{text-decoration:none}.aBn,.unstyle-auto-detected-links *,[x-apple-data-detectors]{border-bottom:0!important;cursor:default!important;color:inherit!important;text-decoration:none!important;font-size:inherit!important;font-family:inherit!important;font-weight:inherit!important;line-height:inherit!important}.a6S{display:none!important;opacity:.01!important}.im{color:inherit!important}img.g-img+div{display:none!important}@media only screen and (min-device-width:320px) and (max-device-width:374px){u~div .email-container{min-width:320px!important}}@media only screen and (min-device-width:375px) and (max-device-width:413px){u~div .email-container{min-width:375px!important}}@media only screen and (min-device-width:414px){u~div .email-container{min-width:414px!important}}</style><style>.primary{background:#30e3ca}.bg_white{background:#fff}.bg_light{background:#fafafa}.bg_black{background:#000}.bg_dark{background:rgba(0,0,0,.8)}.email-section{padding:1.5em 2em}.btn{padding:10px 15px;display:inline-block}.btn.btn-primary{border-radius:5px;background:#30e3ca;color:#fff}.btn.btn-white{border-radius:5px;background:#fff;color:#000}.btn.btn-white-outline{border-radius:5px;background:0 0;border:1px solid #fff;color:#fff}.btn.btn-black-outline{border-radius:0;background:0 0;border:2px solid #000;color:#000;font-weight:700}h1,h2,h3,h4,h5,h6{font-family:Lato,sans-serif;color:#000;margin-top:0;font-weight:400}body{font-family:Lato,sans-serif;font-weight:400;font-size:15px;line-height:1.8;color:rgba(0,0,0,.4)}a{color:#30e3ca}.logo h1{margin:0}.logo h1 a{color:#30e3ca;font-size:24px;font-weight:700;font-family:Lato,sans-serif}.hero{position:relative;z-index:0}.hero .text{color:rgba(0,0,0,.3)}.hero .text h2{color:#000;font-size:40px;margin-bottom:0;font-weight:400;line-height:1.4}.hero .text h3{font-size:24px;font-weight:300}.hero .text h2 span{font-weight:600;color:#30e3ca}.heading-section h2{color:#000;font-size:28px;margin-top:0;line-height:1.4;font-weight:400}.heading-section .subheading{margin-bottom:20px!important;display:inline-block;font-size:13px;text-transform:uppercase;letter-spacing:2px;color:rgba(0,0,0,.4);position:relative}.heading-section .subheading::after{position:absolute;left:0;right:0;bottom:-10px;width:100%;height:2px;background:#30e3ca;margin:0 auto}.heading-section-white{color:rgba(255,255,255,.8)}.heading-section-white h2{line-height:1;padding-bottom:0}.heading-section-white h2{color:#fff}.heading-section-white .subheading{margin-bottom:0;display:inline-block;font-size:13px;text-transform:uppercase;letter-spacing:2px;color:rgba(255,255,255,.4)}ul.social{padding:0}ul.social li{display:inline-block;margin-right:10px}.footer{border-top:1px solid rgba(0,0,0,.05);color:rgba(0,0,0,.5)}.footer .heading{color:#000;font-size:20px}.footer ul{margin:0;padding:0}.footer ul li{list-style:none;margin-bottom:10px}.footer ul li a{color:rgba(0,0,0,1)}</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1;">
	<center style="width: 100%; background-color: #f1f1f1;">
    <div style="display: none; font-size: 1px;max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;">
      &zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
    </div>
    <div style="max-width: 600px; margin: 0 auto;" class="email-container">
    	<!-- BEGIN BODY -->
      <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto;">
      	<tr>
          <td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em;">
          	<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
          		<tr>
          			<td class="logo" style="text-align: center;">
			            <a href="http://celticcapitalfund.com"><img src="https://celticcapitalfund.com/assets/img/logo.png" style="width:250px"></a>
			          </td>
          		</tr>
          	</table>
          </td>
	      </tr><!-- end tr -->
		<tr>
          <td valign="middle" class="hero bg_white" style="padding: 6em 0 4em 0;">
            <table>
            	<tr>
            		<td>
            			<div class="text" style="padding: 0 2.5em; text-align: center;">
            				<h2>2FA VERIFICATION</h2>
            				<h3>Use the code below to verify your login into your account, Please do not share this code with any body!</h3>
                            <h2>'.$otp.'</h2>
            				<!-- <p><a href="#" class="btn btn-primary">Yes! Subscribe Me</a></p> -->
            			</div>
            		</td>
            	</tr>
            </table>
          </td>
	      </tr><!-- end tr -->
      <!-- 1 Column Text + Button : END -->
      </table>
      <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin:auto"><tr><td valign="middle" class="bg_light footer email-section"><table><tr><td valign="top" width="50%" style="padding-top:20px"><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td style="text-align:left;padding-left:5px;padding-right:5px"><h3 class="heading">Contact Info</h3><ul><li><span class="text">info@celticcapitalfund.com</span></li></ul></td></tr></table></td><td valign="top" width="50%" style="padding-top:20px"><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td style="text-align:left;padding-left:10px"><h3 class="heading">Useful Links</h3><ul><li><a href="http://celticcapitalfund.com">Home</a></li><li><a href="http://celticcapitalfund.com/about-us">About</a></li></ul></td></tr></table></td></tr></table></td></tr><tr><td class="bg_light" style="text-align:center"><p>No longer want to receive these email? You can<a href="#" style="color:rgba(0,0,0,.8)">Unsubscribe here</a></p></td></tr></table>
    </div>
  </center>
</body>
</html>';
   }
      public function transaction_alert_msg($tns_type,$amount,$sent_to,$currency){
       return '<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title></title><link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<style>body,html{margin:0 auto!important;padding:0!important;height:100%!important;width:100%!important;background:#f1f1f1}*{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}div[style*="margin: 16px 0"]{margin:0!important}table,td{mso-table-lspace:0!important;mso-table-rspace:0!important}table{border-spacing:0!important;border-collapse:collapse!important;table-layout:fixed!important;margin:0 auto!important}img{-ms-interpolation-mode:bicubic}a{text-decoration:none}.aBn,.unstyle-auto-detected-links *,[x-apple-data-detectors]{border-bottom:0!important;cursor:default!important;color:inherit!important;text-decoration:none!important;font-size:inherit!important;font-family:inherit!important;font-weight:inherit!important;line-height:inherit!important}.a6S{display:none!important;opacity:.01!important}.im{color:inherit!important}img.g-img+div{display:none!important}@media only screen and (min-device-width:320px) and (max-device-width:374px){u~div .email-container{min-width:320px!important}}@media only screen and (min-device-width:375px) and (max-device-width:413px){u~div .email-container{min-width:375px!important}}@media only screen and (min-device-width:414px){u~div .email-container{min-width:414px!important}}</style><style>.primary{background:#30e3ca}.bg_white{background:#fff}.bg_light{background:#fafafa}.bg_black{background:#000}.bg_dark{background:rgba(0,0,0,.8)}.email-section{padding:1.5em 2em}.btn{padding:10px 15px;display:inline-block}.btn.btn-primary{border-radius:5px;background:#30e3ca;color:#fff}.btn.btn-white{border-radius:5px;background:#fff;color:#000}.btn.btn-white-outline{border-radius:5px;background:0 0;border:1px solid #fff;color:#fff}.btn.btn-black-outline{border-radius:0;background:0 0;border:2px solid #000;color:#000;font-weight:700}h1,h2,h3,h4,h5,h6{font-family:Lato,sans-serif;color:#000;margin-top:0;font-weight:400}body{font-family:Lato,sans-serif;font-weight:400;font-size:15px;line-height:1.8;color:rgba(0,0,0,.4)}a{color:#30e3ca}.logo h1{margin:0}.logo h1 a{color:#30e3ca;font-size:24px;font-weight:700;font-family:Lato,sans-serif}.hero{position:relative;z-index:0}.hero .text{color:rgba(0,0,0,.3)}.hero .text h2{color:#000;font-size:40px;margin-bottom:0;font-weight:400;line-height:1.4}.hero .text h3{font-size:24px;font-weight:300}.hero .text h2 span{font-weight:600;color:#30e3ca}.heading-section h2{color:#000;font-size:28px;margin-top:0;line-height:1.4;font-weight:400}.heading-section .subheading{margin-bottom:20px!important;display:inline-block;font-size:13px;text-transform:uppercase;letter-spacing:2px;color:rgba(0,0,0,.4);position:relative}.heading-section .subheading::after{position:absolute;left:0;right:0;bottom:-10px;width:100%;height:2px;background:#30e3ca;margin:0 auto}.heading-section-white{color:rgba(255,255,255,.8)}.heading-section-white h2{line-height:1;padding-bottom:0}.heading-section-white h2{color:#fff}.heading-section-white .subheading{margin-bottom:0;display:inline-block;font-size:13px;text-transform:uppercase;letter-spacing:2px;color:rgba(255,255,255,.4)}ul.social{padding:0}ul.social li{display:inline-block;margin-right:10px}.footer{border-top:1px solid rgba(0,0,0,.05);color:rgba(0,0,0,.5)}.footer .heading{color:#000;font-size:20px}.footer ul{margin:0;padding:0}.footer ul li{list-style:none;margin-bottom:10px}.footer ul li a{color:rgba(0,0,0,1)}</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1;">
	<center style="width: 100%; background-color: #f1f1f1;">
    <div style="display: none; font-size: 1px;max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;">
      &zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
    </div>
    <div style="max-width: 600px; margin: 0 auto;" class="email-container">
    	<!-- BEGIN BODY -->
      <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto;">
      	<tr>
          <td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em;">
          	<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
          		<tr>
          			<td class="logo" style="text-align: center;">
			            <a href="http://celticcapitalfund.com"><img src="https://celticcapitalfund.com/assets/img/logo.png" style="width:250px"></a>
			          </td>
          		</tr>
          	</table>
          </td>
	      </tr><!-- end tr -->
		<tr>
          <td valign="middle" class="hero bg_white" style="padding: 6em 0 4em 0;">
            <table>
            	<tr>
            		<td>
            			<div class="text" style="padding: 0 2.5em; text-align: center;">
            				<h2>Transaction Alert('.$tns_type.')</h2>
            				<h3>Transfer was made from your account to '.$sent_to.' at '.date('jS M Y').'</h3>
                            <h2>Amount Transferred: '.$currency.number_format($amount).'</h2>
            				<!-- <p><a href="" class="btn btn-primary">Yes! Subscribe Me</a></p> -->
            			</div>
            		</td>
            	</tr>
            </table>
          </td>
	      </tr><!-- end tr -->
      <!-- 1 Column Text + Button : END -->
      </table>
      <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin:auto"><tr><td valign="middle" class="bg_light footer email-section"><table><tr><td valign="top" width="50%" style="padding-top:20px"><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td style="text-align:left;padding-left:5px;padding-right:5px"><h3 class="heading">Contact Info</h3><ul><li><span class="text">info@celticcapitalfund.com</span></li></ul></td></tr></table></td><td valign="top" width="50%" style="padding-top:20px"><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td style="text-align:left;padding-left:10px"><h3 class="heading">Useful Links</h3><ul><li><a href="http://celticcapitalfund.com">Home</a></li><li><a href="http://celticcapitalfund.com/about-us">About</a></li></ul></td></tr></table></td></tr></table></td></tr><tr><td class="bg_light" style="text-align:center"><p>No longer want to receive these email? You can<a href="#" style="color:rgba(0,0,0,.8)">Unsubscribe here</a></p></td></tr></table>
    </div>
  </center>
</body>
</html>';
   }
   public function newDeposit($name, $payref,$coinamt,$coinaddr,$coin){
    return '<div style="background-color:white; color:black; display:block; width:100%; padding:10px; font-size:0.85em">
    <h3 style="color:black; text-align:center;">Welcome to Celtic Capital</h3>
    <p style="text-align:center"><strong>New Deposit Initiated</strong></p>
    Hello '.$name.',
    <p>
    Your Deposit order has been placed and now awaiting confirmation of payment
    <br>Your Deposit details are shown below.</p>
    <p>
    <small>Payment Reference:  '.$payref.'</small><br>
    <small>Payment Amount: '.$coinamt.' </small><br>
    <small>Payment Method: Crypto Wallet ('.$coinamt.')</small><br>
    <small>Dated Initiated: '.date('m/d/Y h:i').'</small><br>
    </p>
    <p>
    If you are yet to make this payment kindly send '.$coinamt.' worth of '.$coin.' to the following '.$coin.' address: '.$coinaddr.' 
    <br>Once payment is confirmed, your account will be funded.</p>
    <p>
    feel free to contact us if you have any question.

    </p>
    
    <br>
    <small><em>The Celtic Capital Team</em></small>
    </div>';
}
public function newInvestment($name, $payref,$coinamt,$invplan){
  return '<div style="background-color:white; color:black; display:block; width:100%; padding:10px; font-size:0.85em">
  <h3 style="color:black; text-align:center;">Welcome to Celtic Capital</h3>
  <p style="text-align:center"><strong>New Investment Initiated</strong></p>
  Hello '.$name.',
  <p>
  Your Investment has started,
  <br>Your Investment details are shown below.</p>
  <p>
  <small>Investment Reference:  '.$payref.'</small><br>
  <small>Investment Plan: '.$invplan.' </small><br>
  <small>Invest Amount: '.$coinamt.' </small><br>
  <small>Payment Method: Wallet Balance</small><br>
  <small>Dated Initiated: '.date('m/d/Y h:i').'</small><br>
  </p>
  <p>
  feel free to contact us if you have any question.

  </p>
  
  <br>
  <small><em>The Celtic Capital Team</em></small>
  </div>';
}
public function newWithdrawal($name, $amount,$withdrawal_means){
  return '<div style="background-color:white; color:black; display:block; width:100%; padding:10px; font-size:0.85em">
  <h3 style="color:black; text-align:center;">Welcome to Celtic Capital</h3>
  <p style="text-align:center"><strong>Withdrawal Initiated</strong></p>
  Hello '.$name.',
  <p>
  You just requested for a Withdrawal.
  <br>Details of your withdrawal below.</p>
  <p>
  <small>Means of withdrawal:  '.$withdrawal_means.'</small><br>
  <small>Withdrawal Amount: '.$amount.' </small><br>
  <small>Dated Initiated: '.date('m/d/Y h:i').'</small><br>
  </p>
  <br>If you did not initiate this withdrawal, kindly fill our contact form on our website : <a href="https://celticcapitalfund.com/contact">celticcapitalfund.com</a></p>
  <p>
  feel free to contact us if you have any question.

  </p>
  
  <br>
  <small><em>The Celtic Capital Team</em></small>
  </div>';
}
public function changePassword($name){
  return '<div style="background-color:white; color:black; display:block; width:100%; padding:10px; font-size:0.85em">
  <h3 style="color:black; text-align:center;">Welcome to Celtic Capital</h3>
  <p style="text-align:center"><strong>Account Password Change</strong></p>
  Hello '.$name.',
  <p>
  Your Account Password has been changed successfuly,
  <br>If you did not change your account password, kindly fill our contact form on our website : <a href="https://celticcapitalfund.com/contact">celticcapitalfund.com</a></p>
  <p>
  feel free to contact us if you have any question.

  </p>
  
  <br>
  <small><em>The Celtic Capital Team</em></small>
  </div>';
}
public function addPaymentMethod($name){
  return '<div style="background-color:white; color:black; display:block; width:100%; padding:10px; font-size:0.85em">
  <h3 style="color:black; text-align:center;">Welcome to Celtic Capital</h3>
  <p style="text-align:center"><strong>New Withdrawal Method Added</strong></p>
  Hello '.$name.',
  <p>
  You just added a New means of withdrawal of funds to your account,
  <br>If you did not add this method, kindly fill our contact form on our website : <a href="https://celticcapitalfund.com/contact">celticcapitalfund.com</a></p>
  <p>
  feel free to contact us if you have any question.

  </p>
  
  <br>
  <small><em>The Celtic Capital Team</em></small>
  </div>';
}
}