Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'PHPMailer/PHPMailerAutoload.php';
- if (!empty($_POST['nome']) && !empty($_POST['email']) && !empty($_POST['numero']) && !empty($_POST['msg'])) {
- $nome = $_POST['nome'];
- $email = $_POST['email'];
- $numero = $_POST['numero'];
- $msg = $_POST['msg'];
- } else {
- return false;
- header("Location: https://eduuamorim.com");
- }
- $Mailer = new PHPMailer();
- //Define que será usado SMTP
- $Mailer->IsSMTP();
- //Enviar e-mail em HTML
- $Mailer->isHTML(true);
- //Aceitar carasteres especiais
- $Mailer->Charset = 'UTF-8';
- //Configurações
- $Mailer->SMTPAuth = true;
- $Mailer->SMTPSecure = 'ssl';
- //nome do servidor
- $Mailer->Host = 'eduuamorim.com';
- //Porta de saida de e-mail
- $Mailer->Port = 465;
- //Dados do e-mail de saida - autenticação
- $Mailer->Username = 'suporte@eduuamorim.com';
- $Mailer->Password = 'aqui a senha :)';
- //E-mail remetente (deve ser o mesmo de quem fez a autenticação)
- $Mailer->From = 'suporte@eduuamorim.com';
- //Nome do Remetente
- $Mailer->FromName = 'Robot - eduuamorim'."\n";
- //Assunto da mensagem
- $Mailer->Subject = 'Nova mensagem! :)';
- //Corpo da Mensagem
- $Mailer->Body =
- '<strong>Nome: </strong><br>'.$nome.'<br><br>
- <strong>Email: </strong><br>'.$email.'<br><br>
- <strong>Numero: </strong><br>'.$numero.'<br><br>
- <strong>Mensagem: </strong><br>'.$msg.'<br>';
- //Corpo da mensagem em texto
- $Mailer->AltBody = '';
- //Destinatario
- $Mailer->AddAddress('eduuamorim1@gmail.com');
- if($Mailer->Send()){
- echo ("
- <script>
- window.alert('Mensagem enviada com sucesso!')
- window.location.href='index.php';
- </script>
- window.location.href='index.php';
- </script>
- ");
- } else{
- echo ("<script>
- window.alert('Mensagem não enviada!')
- window.location.href='index.php';
- </script>");
- }
- $Mailer->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement