Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phpmailer/src/Exception.php';
- require 'phpmailer/src/PHPMailer.php';
- require 'phpmailer/src/SMTP.php';
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- if(!isset($_POST['email']))
- die("Não recebi nenhum par&acitc;metro. Por favor volte ao formulario.html antes");
- $emailsender = "contato@anjosdosorriso.com.br";
- /* Verifica qual é o sistema operacional do servidor para ajustar o cabeçalho de forma correta. Não alterar */
- if(PHP_OS == "Linux") $quebra_linha = "\n"; //Se for Linux
- elseif(PHP_OS == "WINNT") $quebra_linha = "\r\n"; // Se for Windows
- else die("Este script nao esta preparado para funcionar com o sistema operacional de seu servidor");
- // Passando os dados obtidos pelo formulário para as variáveis abaixo
- $nomeremetente = $_POST['nome'];
- $empresa = $_POST['empresa'];
- $emaildestinatario = 'isaias@anjosdosorriso.com.br';
- $email = $_POST['email'];
- $phone = $_POST['phone'];
- $descricao = $_POST['descricao'];
- $servicos = $_POST['servicos'];
- /* Montando a mensagem a ser enviada no corpo do e-mail. */
- $mensagemHTML = '<h1>Solicitação Orçamento</h1>'
- . '<p><strong>Nome: </strong> '.$nomeremetente.'</p>'
- . '<p><strong>E-mail: </strong> '.$email.'</p>'
- . '<p><strong>Telefone: </strong> '.$phone.'</p>'
- . '<p><strong>Serviços: </strong> '.$servicos.'</p>'
- . '<p><strong>Mensagem: </strong> '.$descricao.'</p>'
- . '<hr>';
- $mail = new PHPMailer(true); // Passing `true` enables exceptions
- try {
- //Server settings
- $mail->SMTPDebug = 1; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Port = 587; // TCP port to connect to
- $mail->Host = 'smtp.anjosdosorriso.com.br'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'dev@anjosdosorriso.com.br'; // SMTP username
- $mail->Password = 'Loca20$$18'; // SMTP password
- //$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->CharSet = "UTF-8";
- //Recipients
- $mail->setFrom('dev@anjosdosorriso.com.br', 'Anjos do Sorriso');
- $mail->addAddress('filipe.santos_@live.com', 'Filipe Santos'); // Add a recipient
- //$mail->addReplyTo('contato@anjosdosorriso.com.br', 'Anjos do Sorriso');
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('filipe.santos_@live.com');
- //Content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = '[WEBSITE] Cadastro Newsletter';
- $mail->Body = $mensagemHTML;
- //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- $mail->send();
- print_r($mail);
- } catch (Exception $e) {
- print $e;
- // print '<script type="text/javascript">' .
- // 'setTimeout(function(){' .
- // 'window.location.href="' . $_SERVER['REQUEST_URI'] . '?send=false";'.
- // '}, 1000);'.
- // '</script>';
- return;
- }
- /* Mostrando na tela as informações enviadas por e-mail */
- // print '<script type="text/javascript">' .
- // 'setTimeout(function(){' .
- // 'window.location.href="' . $_SERVER['REQUEST_URI'] . '/?send=true";'.
- // '}, 1000);'.
- // '</script>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement