Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
992
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?php
  2.  
  3. use PHPMailer\PHPMailer;
  4. use PHPMailer\PHPMailer\SMTP;
  5. use PHPMailer\PHPMailer\OAuth;
  6. use PHPMailer\PHPMailer\Exception;
  7.  
  8. require '../php/phpmailer/class/PHPMailer.php';
  9. require '../php/phpmailer/class/SMTP.php';
  10. require '../php/phpmailer/class/OAuth.php';
  11. require '../php/phpmailer/class/Exception.php';
  12.  
  13.  // Inicia a Classe PHPMailer
  14.  $mailer = new PHPMailer\PHPMailer(true);
  15.  try{
  16.   // Recebe as Variáveis
  17.   $formNome = $_POST["formNome"];
  18.   $formSobrenome = $_POST["formSobrenome"];
  19.   $formEmpresa = $_POST["formEmpresa"];
  20.   $formTelefone = $_POST["formTelefone"];
  21.   $formCelular = $_POST["formCelular"];
  22.   $formEmail = $_POST["formEmail"];
  23.   $formMensagem = $_POST["formMensagem"];
  24.  
  25.   // Define: Dados do Servidor & Tipo de Conexão
  26.   $mailer->SMTPDebug = 2;
  27.   $mailer->isSMTP();
  28.   $mailer->SMTPAuth = true;
  29.   $mailer->SMTPSecure = 'ssl';
  30.   //$mailer->Host = 'smtp.uhserver.com';
  31.   //$mailer->Host = 'smtp.flickamarketing.com.br';
  32.   //$mailer->Host = 'smtp.gmail.com';
  33.   $mailer->Host = 'smtp.gmail.com';
  34.   $mailer->Port = 465; // Porta de Entrada/Saida SSL do GMAIL
  35.   $mailer->Username = 'thiagodbonis@gmail.com';
  36.   $mailer->Password = '***';
  37.  
  38.   // Define: O formato do E-mail
  39.   $mailer->IsHTML(true);
  40.  
  41.   // Define: Remetende do E-mail
  42.   $mailer->setFrom($formEmail, $formNome);
  43.  
  44.   // Define: Destinatário do E-mail
  45.   $mailer->addAddress($mailer->Username, "FLICKA MARKETING");
  46.  
  47.   //$mailer->AddCC('email@seuemail.com.br', 'Eu'); - Email em Copia p/ outro Email
  48.   $mailer->Subject = 'FORMULÁRIO FLICKA MARKETING';
  49.   $mailer->Body = nl2br("<strong>Desenvolvido por: <font color='red'>Thiago De Bonis Carvalho Saad Saud</font></strong>\n" . "==================================================\n" ."<strong>NOME:</strong> " . $formNome . " " . $formSobrenome . "\n\n<strong>EMPRESA:</strong> " . $formEmpresa . "\n\n<strong>TELEFONE:</strong> " . $formTelefone . "\n\n<strong>CELULAR:</strong> " . $formCelular . "\n\n<strong>E-MAIL</strong>: " . $formEmail . "\n\n<strong>MENSAGEM:</strong> " . $formMensagem . "\n==================================================");
  50.   // Enviar o E-mail & Exibirá uma mensagem de Resultado
  51.   $mailer->Send();
  52.  
  53.  
  54.   }catch (Exception $e){
  55.     header("HTTP/1.0 404 Not Found");
  56.   }
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement