%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home1/dimen328/libertysa.com.br/admin/modules/contato/
Upload File :
Create Path :
Current File : //home1/dimen328/libertysa.com.br/admin/modules/contato/emailCTRL.php

<?php
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require_once("../PHPmailer/DAO.php");
include_once("../../PHPMailerNovo/src/Exception.php");
include_once("../../PHPMailerNovo/src/PHPMailer.php");
include_once("../../PHPMailerNovo/src/SMTP.php");
require_once("../../../includes/functions.php");
require_once("../../includes/UploadMax.php");

$oper = $_POST['oper'];


switch($oper){

    case 1:
        $mailerDao = new DAO;
        $info = $mailerDao->preencher(1);

        if(isset($_POST["sobrenome"])){
            $nome = htmlentities($_POST["nome"]." ".$_POST["sobrenome"]);
        }
        else{
            $nome = htmlentities($_POST["nome"]);
        }

        $email = htmlentities($_POST["email"]);
        $telefone = htmlentities($_POST["telefone"]);
        $assunto = "Novo contato enviado pelo site";
        $mensagem = htmlentities($_POST["mensagem"]);

        $ip = $_SERVER['REMOTE_ADDR'];
        date_default_timezone_set('America/Sao_Paulo');
        $data = date('d-m-Y H:i:s');

        $corpo = '<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td style="padding: 20px 0 30px 0;">
							<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
								<!--logotipo-->
								<tr style="">
									<td align="center" style="padding: 15px 0px;">
										<img src="'.base_url('media/images/logo.png').'" alt="logotipo" style="display: block; width: 100px; height: auto;" />
									</td>
								</tr>
							</table>
							<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse; border: 2px solid #cccccc">
								<!--conteudo-->
								<tr>
									<td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;" >
										<table border="0" cellpadding="0" cellspacing="0" width="100%" >
											<!--assunto-->
											<tr>
												<td colspan="2" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 24px; text-align:center">
													<b>Novo Contato de '.$nome.' - Liberty Serviços</b>
												</td>
											</tr>
											<!--Mensagem corpo-->
											<tr>
												<td style="padding: 20px 0 30px 0; color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;border-bottom: 1px solid #3B3B3B;" colspan="3">
													<!--b>Mensagem</b-->
													<p>'.$mensagem.'</p>
													<br /><b>De: </b>'.$nome.'
												</td>
											</tr>
											<!--Informações Gerais-->									
											<!--table border="0" cellpadding="0" cellspacing="0" width="100%">		</table-->						
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Email: </b><p>'.$email.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Telefone: </b><p>'.$telefone.'</p>
												</td>
											 </tr>
										</table>
									</td>
								</tr>
								<!--rodapé-->
								<tr>
									<td bgcolor="#3B3B3B" style="padding: 30px 30px 30px 30px;border: 2px solid #CCC;border-top: 0;">    
										<table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tr>
												<td style="color: #ffffff; font-family: Arial, sans-serif;">
													<small><b>Horário do servidor:</b> <span style="color:#76baff">'. date('d/m/Y H:i:s') .' </span><b>- IP: </b><span style="color:#76baff">'.$ip.'</span></small>
												</td>
											</tr>
											<tr>
												<td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;">
												<b>Liberty Serviços</b> <small>&reg;</small> '.date('Y').' | Todos os direitos reservados. <br/>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>';

        $mail = new PHPMailer;
        $mail->isSMTP();
        $mail->CharSet = 'UTF-8';

        //Server settings
        $mail->SMTPDebug = 0;                                        // Enable verbose debug output
        $mail->isSMTP();                                            // Set mailer to use SMTP
        $mail->Host = $info->Host;                                 // Specify main and backup SMTP servers
        $mail->SMTPSecure = $info->SMTPSecure;                    // Enable TLS encryption, `ssl` also accepted
        $mail->Port = $info->Port;                               // TCP port to connect to
        $mail->SMTPAuth = $info->SMTPAuth;                      // Enable SMTP authentication
        $mail->Username = $info->Username;                     // SMTP username
        $mail->Password = $info->Password;                    // SMTP password

        //Recipients
        $mail->setFrom($info->Username);
        $mail->AddAddress('comercial@dimensaogrupo.com.br', 'Dimensão Grupo');
        //$mail->AddAddress('suporte@superteia.com.br', 'Dimensão Grupo');

        // Define a mensagem (Texto e Assunto)
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        $mail->IsHTML(true); // Define que o e-mail será enviado como HTML
        $mail->Subject  = $assunto; // Assunto da mensagem
        $mail->Body = $corpo;

        try
        {
            if (!$mail->Send())
            {
                $retorno['msg'] = 0;
                $retorno['erro'] = "E-mail não pode ser enviado. Erro: " . $mail->ErrorInfo;
            }
            else
            {
                $retorno['msg'] = 1;
                $retorno['erro'] = "E-mail enviado com Sucesso!";
            }

            // Limpa os destinatários e os anexos
            $mail->ClearAllRecipients();

            echo json_encode($retorno);
        }
        catch(Exception $e)
        {
            print_r($mail->ErrorInfo);
        }
    break;

    case 2:
        $nome = htmlentities($_POST["nome"]." ".$_POST["sobrenome"]);
        $nascimento = htmlentities($_POST["dataNascimento"]);
        $email = htmlentities($_POST["email"]);
        $telefone = htmlentities($_POST["telefone"]);
        $endereco = htmlentities($_POST["endereco"]);
        $complemento = htmlentities($_POST["complemento"]);
        $cidade = htmlentities($_POST["cidade"]);
        $estado = htmlentities($_POST["inputEstado"]);
        $cep = htmlentities($_POST["cep"]);
        $rg = htmlentities($_POST["rg"]);
        $cpf = htmlentities($_POST["cpf"]);
        $estadoCivil = htmlentities($_POST["estadoCivil"]);
        $areaPretendida = htmlentities($_POST["areaPretendida"]);
        $formacaoECursos = htmlentities($_POST["formacaoECursos"]);
        $experienciasProfissionais = htmlentities($_POST["experienciasProfissionais"]);
        $assunto = "Novo contato enviado pelo Trabalhe Conosco do site";

        //fazer o upload dos arquivos
        if(!empty($_FILES['curriculo']['tmp_name'])){
            $uploader = new Upload();
            $uploader->setArquivo($_FILES['curriculo']);
            if($uploader->validate(".pdf;.doc;.docx;"))
            {
                $uploader->setPastaDestino('../../uploads/curriculos/');
                $uploader->setNomeSaida(md5(uniqid()));

                if($uploader->doUpload()){
                    $anexo = '../../uploads/curriculos/'.$uploader->getNomeSaida();
                }
                else {
                    $anexo = null;
                }
            }
            else{
                $anexo = null;
            }
        }
        else{
            $anexo = null;
        }

        $ip = $_SERVER['REMOTE_ADDR'];
        date_default_timezone_set('America/Sao_Paulo');
        $data = date('d-m-Y H:i:s');

        $corpo = '<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td style="padding: 20px 0 30px 0;">
							<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
								<!--logotipo-->
								<tr style="">
									<td align="center" style="padding: 15px 0px;">
										<img src="'.base_url('media/images/logo.png').'" alt="logotipo" style="display: block; width: 100px; height: auto;" />
									</td>
								</tr>
							</table>
							<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse; border: 2px solid #cccccc">
								<!--conteudo-->
								<tr>
									<td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;" >
										<table border="0" cellpadding="0" cellspacing="0" width="100%" >
											<!--assunto-->
											<tr>
												<td colspan="2" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 24px; text-align:center">
													<b>Novo Contato de '.$nome.' - Liberty Serviços</b>
												</td>
											</tr>
											<tr>
												<td style="padding: 20px 0 30px 0; color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;border-bottom: 1px solid #3B3B3B;" colspan="3">
													<br /><b>De: </b>'.$nome.'
												</td>
											</tr>
											<!--Informações Gerais-->													
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Email: </b><p>'.$email.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Telefone: </b><p>'.$telefone.'</p>
												</td>
											 </tr>
											 <tr>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Data de nascimento: </b><p>'.$nascimento.'</p>
												</td>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Endereço: </b><p>'.$endereco.'</p>
												</td>
											 </tr>
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Complemento: </b><p>'.$complemento.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Cidade: </b><p>'.$cidade.'</p>
												</td>
											 </tr>
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Estado: </b><p>'.$estado.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Cep: </b><p>'.$cep.'</p>
												</td>
											 </tr>
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>RG: </b><p>'.$rg.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>CPF: </b><p>'.$cpf.'</p>
												</td>
											 </tr>
											 <tr>
												<td width="300" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
													<b>Estado Civil: </b><p>'.$estadoCivil.'</p>
												</td>
												<td width="150" valign="top" style="color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;padding-top: 30px;">
												</td>
											 </tr>
											 <tr>
												<td style="padding: 20px 0 30px 0; color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;border-bottom: 1px solid #3B3B3B;" colspan="3">
													<b>Área pretendida</b>
													<p>'.$areaPretendida.'</p>
												</td>
                                             </tr>
                                             <tr>
												<td style="padding: 20px 0 30px 0; color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;border-bottom: 1px solid #3B3B3B;" colspan="3">
													<b>Formação e Cursos</b>
													<p>'.$formacaoECursos.'</p>
												</td>
                                             </tr>
                                             <tr>
												<td style="padding: 20px 0 30px 0; color: #3B3B3B; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;border-bottom: 1px solid #3B3B3B;" colspan="3">
													<b>Experiencias Profissionais</b>
													<p>'.$experienciasProfissionais.'</p>
												</td>
                                             </tr>
										</table>
									</td>
								</tr>
								<!--rodapé-->
								<tr>
									<td bgcolor="#3B3B3B" style="padding: 30px 30px 30px 30px;border: 2px solid #CCC;border-top: 0;">    
										<table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tr>
												<td style="color: #ffffff; font-family: Arial, sans-serif;">
													<small><b>Horário do servidor:</b> <span style="color:#76baff">'. date('d/m/Y H:i:s') .' </span><b>- IP: </b><span style="color:#76baff">'.$ip.'</span></small>
												</td>
											</tr>
											<tr>
												<td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;">
												<b>Liberty Serviços</b> <small>&reg;</small> '.date('Y').' | Todos os direitos reservados. <br/>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>';

        $mailerDao = new DAO;
        $info = $mailerDao->preencher(1);

        $mail = new PHPMailer;
        $mail->isSMTP();
        $mail->CharSet = 'UTF-8';

        //Server settings
        $mail->SMTPDebug = 0;                                        // Enable verbose debug output
        $mail->isSMTP();                                            // Set mailer to use SMTP
        $mail->Host = $info->Host;                                 // Specify main and backup SMTP servers
        $mail->SMTPSecure = $info->SMTPSecure;                    // Enable TLS encryption, `ssl` also accepted
        $mail->Port = $info->Port;                               // TCP port to connect to
        $mail->SMTPAuth = $info->SMTPAuth;                      // Enable SMTP authentication
        $mail->Username = $info->Username;                     // SMTP username
        $mail->Password = $info->Password;                    // SMTP password

        //Recipients
        $mail->setFrom($info->Username);
        $mail->AddAddress('selecao@dimensaogrupo.com.br', 'Dimensão Grupo');
        //$mail->AddAddress('suporte@superteia.com.br', 'Dimensão Grupo');

        // Define a mensagem (Texto e Assunto)
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        $mail->IsHTML(true); // Define que o e-mail será enviado como HTML
        $mail->Subject  = $assunto; // Assunto da mensagem
        $mail->Body = $corpo;

        if(!empty($anexo)){
            $mail->addAttachment($anexo, 'Curriculo '.$nome);
        }

        try
        {
            if (!$mail->Send())
            {
                $retorno['msg'] = 0;
                $retorno['erro'] = "E-mail não pode ser enviado. Erro: " . $mail->ErrorInfo;
            }
            else
            {
                $retorno['msg'] = 1;
                $retorno['erro'] = "E-mail enviado com Sucesso!";
            }

            @unlink($anexo);

            // Limpa os destinatários e os anexos
            $mail->ClearAllRecipients();

            echo json_encode($retorno);
        }
        catch(Exception $e)
        {
            @unlink($anexo);

            print_r($mail->ErrorInfo);
        }
    break;
    default;
        break;
}


?>

Zerion Mini Shell 1.0