 <?php
  function send_mail($email, $messag, $subject)
  {
    require_once('mailer/class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "ssl";
    $mail->Host = "alphaedgecb.com";
    $mail->Port = 465;
    $mail->AddAddress($email);
    $mail->Username = "noreply@alphaedgecb.com";
    $mail->Password = "vision2020";
    $mail->SetFrom('noreply@alphaedgecb.com', 'AlphaEdge Commercial Bank');
    $mail->AddReplyTo("noreply@alphaedgecb.com", "AlphaEdge Commercial Bank");
    $mail->Subject = $subject;
    $mail->MsgHTML($messag);
    $mail->Send();
  }
  //-----------EDIT THIS AREA TO SEND MAIL-----------//



  function otp($to, $msg)
  {
    //twillio
    $sid = "AC8a51a397c10585759372688cdc032e0c"; // Your Account SID from www.twilio.com/console
    $token = "d4d4f424218c67a2e4963951eea9134c"; // Your Auth Token from www.twilio.com/console
    $client = new Twilio\Rest\Client($sid, $token);
    try {
      $message = $client->messages->create(
        '+' . $to,
        array(
          'from' => 'AlphaEdge Commercial Bank', // From a valid Twilio number
          'body' => $msg
        )
      );
      // Display a confirmation message on the screen
      echo "Sent message to $name";

      //sent successfully
      echo "sent to $to successfully<br>";
    } catch (Exception $e) {
      echo $e->getCode() . ' : ' . $e->getMessage() . "<br>";
    }
  }

  ?>