public function sendEmail() { try { $emails = explode(',', $this->_correo); $to = []; foreach ($emails as $email) { $params = ['mail' => ['requerido' => 1, 'validador' => 'esEmail', 'mensaje' => utf8_encode('El correo no es válido.')]]; $destinatario = ['name' => $email, 'mail' => $email]; $form = new Validator($destinatario, $params); if ($form->validate() === false) { throw new Exception('El correo ' . $email . ' no es válido.'); } $to[] = $destinatario; } $this->_template = ParserTemplate::parseTemplate($this->_template, $this->_info); // $subject = '', $body = '', $to = array(), $cc = array(), $bcc = array(), $att = array() if (Mailer::sendMail($this->_subject, $this->_template, $to, $this->_cc)) { return true; } else { return false; } } catch (phpmailerException $e) { $this->_PDOConn->rollBack(); return false; } }
public static function sendMailFromAgentThird($correo, $mensaje, $archivo = false) { $emails = explode(',', $correo); $to = array(); foreach ($emails as $email) { $mail = $email; $destinatario = array('name' => $email, 'mail' => $email); if (($email = FilterInput::FilterValue($email, 'email', true)) === false) { throw new Exception('El correo ' . $mail . ' no es válido.'); } $to[] = $destinatario; } $data = array('one' => $mensaje['one'], 'two' => $mensaje['two'], 'three' => $mensaje['three'], 'four' => $mensaje['four'], 'five' => $mensaje['five'], 'six' => $mensaje['six'], 'seven' => $mensaje['seven'], 'eight' => $mensaje['eight'], 'nine' => $mensaje['nine'], 'ten' => $mensaje['ten']); $tpl = ParserTemplate::parseTemplate('envio_inventario_third.html', $data); $correos = array(array('mail' => '*****@*****.**', 'name' => 'Jesús'), array('mail' => '*****@*****.**', 'name' => 'Vico')); if (Mailer::sendMail('Encuesta ONE / Tercer Review', $tpl, $to, '', $correos)) { return array('success' => true, 'message' => 'Correo enviado.'); } }
<?php session_name('kidzania-session'); session_cache_expire('60480'); session_start(); define('ACTUAL_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'snippets'); require_once ACTUAL_PATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.php'; if (array_key_exists('id', $_SESSION) && !empty($_SESSION['id'])) { header('Location: ' . SITE_URL); } else { $_SESSION['id'] = $_SESSION['email']; $file = 'gracias.tpl'; $codes = array('mty' => '4677CPKHEKP1CDE', 'cui' => '419A2PNHOEO124A', 'sfe' => 'DC219PNHZQO1A2D'); $tpl = ParserTemplate::parseTemplate($file, $codes); echo $tpl; }