<?php

class SendMail extends PHPMailer{

static function send_notify($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$_from = 'hello@fancision.io'){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = 0;
            $mail->Host = "email-smtp.us-west-2.amazonaws.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "AKIA57CBEVHRAI7FALDD";
            $mail->Password = 'BC7niXRAmaF5iPC3vj/3BJEdZFdIHZOoKKY8c1EtSFvH';
            $mail->setFrom($_from, "Fancision");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
static function send_notify2($__template , $__subject,$__to,$__name,$__from, $__search= NULL, $__replace= NULL){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/plain_text/'.$__template.'.txt');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = 0;
            $mail->Host = "";
            $mail->Port = "587";
            $mail->SMTPSecure = "none";
            $mail->SMTPAuth = true;
            $mail->Username = "";
            $mail->Password = "";
            $mail->setFrom("info@hyncha.com", "HYNCHA");
            $mail->addAddress($__to, $__name);           
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
			$mail->isHTML(false);          
            $mail->SMTPOptions = array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            )
        );
            $mail->Body = $newbody; //Create message bodies and embed images
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
static function send_notify3($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$_from = 'hello@fancision.io'){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
	$mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = 0;
            $mail->Host = "email-smtp.us-west-2.amazonaws.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "AKIA57CBEVHRAI7FALDD";
            $mail->Password = 'BC7niXRAmaF5iPC3vj/3BJEdZFdIHZOoKKY8c1EtSFvH';
            $mail->setFrom($_from, "Fancision");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $enviado = false;
        }
        return $enviado;
}
static function send_notify_a($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.agriquimvet.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "cotizaciones@agriquimvet.com";
            $mail->Password = 'dbENohSqpaeU';
            $mail->setFrom("cotizaciones@agriquimvet.com", "Cotizaciones Agriquimvet");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
static function send_notify_moot($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.softhomesolutions.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "mootve2023@softhomesolutions.com";
            $mail->Password = 'dbENohSqpaeU';
            $mail->setFrom("mootve2023@softhomesolutions.com", "Operaciones MootVe 2023");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}

static function send_notify_paxtu($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.softhomesolutions.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "paxtuve25@softhomesolutions.com";
            $mail->Password = '*[Zqtbe64QZ3';
            $mail->setFrom("paxtuve25@softhomesolutions.com", "PaxtuVe 2025");
			$mail->addReplyTo('paxtu@scouts.org.ve');
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}

static function send_notify_jamb($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.softhomesolutions.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "jamboreeve24@softhomesolutions.com";
            $mail->Password = '*[Zqtbe64QZ3';
            $mail->setFrom("jamboreeve24@softhomesolutions.com", "JamboreeVe 2024");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
static function send_notify_jamb2($__template , $__subject,$__to,$__search= NULL, $__replace= NULL,$__debug = 0){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.softhomesolutions.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "jamboreeve24@softhomesolutions.com";
            $mail->Password = '*[Zqtbe64QZ3';
            $mail->setFrom("jamboreeve24@softhomesolutions.com", "JamboreeVe 2024");
			if($__to){
				if(is_array($__to)){
					foreach($__to as $e => $n){
						$mail->addAddress($e, $n);
					}
				}else{
				return;
				}
			}else{
				return;
			}
			$mail->AddBCC("avrahamquevedo@gmail.com", "Abraham Quevedo");
			$mail->AddBCC("silveriou@gmail.com", "Silverio");
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
/*static function send_notify_jamb($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "smtp1.s.ipzmarketing.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            //$mail->SMTPAuth = true;
            $mail->Username = "dojkrojyowmw";
            $mail->Password = 'JR3ViltL4Cu7_yVy';
            $mail->setFrom("jamboreeve24@softhomesolutions.com", "JamboreeVe 2024");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}*/
//k1BjeTb)M3GD
static function send_notify_comerfc($__template , $__subject,$__to,$__name,$__search= NULL, $__replace= NULL,$__debug = 0,$binary_content = null,$file_url = null){
    //transactional-emails\inlined
    $body = file_get_contents(APPROOT.'lib/class/transactional-emails/inlined/'.$__template.'.html');
    $newbody = str_replace($__search, $__replace, $body);
    $mail = new PHPMailer(true);
        $mail->CharSet = 'utf-8';
        try {
            $mail->isSMTP();
            $mail->SMTPDebug = $__debug;
            $mail->Host = "mail.softhomesolutions.com";
            $mail->Port = "587";
            $mail->SMTPSecure = "tls";
            $mail->SMTPAuth = true;
            $mail->Username = "comerfc@softhomesolutions.com";
            $mail->Password = 'k1BjeTb)M3GD';
            $mail->setFrom("comerfc@softhomesolutions.com", "WebApp Comercializadora FC 2023");
            $mail->addAddress($__to, $__name);
            $mail->Subject = $__subject;
            $mail->WordWrap = 78;
            $mail->msgHTML($newbody, dirname(__FILE__), true); //Create message bodies and embed images
            if($binary_content){
                $mail->AddStringAttachment($binary_content, "sales_invoice.pdf", $encoding = 'base64', $type = 'application/pdf'); 
            }
            if($file_url){
                $mail->addAttachment($file_url['file'], $file_url['name']);
            }
            try {
                $mail->send();
                $results_messages = "Message has been sent using SMTP";
                $enviado = true;
            } catch (Exception $e) {
				$enviado = false;
                $results_messages = 'Unable to send to: ' . $__to . ': ' . $e->getMessage();
            }
        } catch (Exception $e) {
            $results_messages = 'Error general: '.$e->errorMessage();
        }
        return $results_messages;
}
}