<?php namespace App\Controllers;
class Sender{

public function sendEmail($mail){
    
    $to = $mail["email"];

   $message = '<div>
  <img src="https://soaringskillsinstitute.com/public/images/logo.png" alt="Soaring Skills Training Institute Header"/>
  </div>
  <div style="font-family:verdana;margin-left:10px;font-size:10pt;color:#5F6368">
  Dear '.$mail["name"].',<br>
  We invite you for  training course on '.$mail["courseName"].' to be held from '.$mail["startDate"].' to '.$mail["endDate"].'.<br/>
  Please find attached the Official Invitation letter to present during admission.
  <div class="col-md-6">Invoice No. '.$mail["invoiceId"].'</div>
  <div class="col-md-6">'.$mail["invoiceId"].'</div>
  
 
  Regards,<br/>
  Amos Mwangi<br/>
  Head of Training <br/>
  Soaring Skills Training Institute.<br/>
  </div>

<div style="width:100%">
<img src="https://soaringskillsinstitute.com/public/images/footer.png" alt="Soaring Skills Training Institute"/>
</div>';


   $email = \Config\Services::email();
   $email->setFrom('training@soaringskillsinstitute.com', 'Soaring Skills Training Institute ');
   $to = $mail['emailAddress'];
   $email->setTo($to);
   $email->setSubject('Training Application Invoice | Soaring Skills Training Institute');
   $email->setMessage($message);//your message here
   // Email body content

 
//   $email->setCC();//CC
//   $email->setBCC('training@soaringskillsinstitute.com');// and BCC
$email->setCC('training@soaringskillsinstitute.com');// and BCC
  $email->setBCC('paulgichohi@gmail.com');// and BCC
 $filename = 'public/images/apps/invoice.pdf'; //you can use the App patch 
   $email->attach($filename);
    
   $email->send();
   $email->printDebugger(['headers']);
}
}
?>