Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once ("PHPMailer/PHPMailerAutoload.php");
- #Receber variáveis
- $nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
- $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
- $telefone = filter_input(INPUT_POST, 'telefone', FILTER_SANITIZE_STRING);
- $empresa = filter_input(INPUT_POST, 'empresa', FILTER_SANITIZE_STRING);
- $mensagem = filter_input(INPUT_POST, 'mensagem', FILTER_SANITIZE_STRING);
- #Instanciar nova classe
- $mail = new PHPMailer();
- $mail->isSMTP();
- try {
- $mail->Host = 'ssl://smtp.gmail.com:465';
- $mail->SMTPAuth = true;
- $mail->Port = 587;
- $mail->Username = 'seuemail@gmail.com';
- $mail->Password = 'SuaSenhAqui';
- // Email e nome do cliente, preenchidos no formulário
- $mail->setFrom($email, $nome);
- //Email para o qual deseja fazer o envio dos dados do formulário.
- $mail->addAddress('seuemail@gmail.com', 'MN Soluções em Informática');
- $mail->isHTML(true);
- $mail->Subject = 'Pedido orçamento';
- $mail->Body = "
- <strong>Pedido orçamento</strong><br>
- Nome: $nome <br>
- E-mail : $email <br>
- Telefone: $telefone <br>
- Empresa: $empresa <br>
- Mensagem: $mensagem <br>
- ";
- } catch (phpmailerException $e) {
- }
- if(!$mail->send()){
- echo "
- <script>
- alert('Falha no envio!');
- window.location.href='index.html';
- </script>";
- } else {
- echo "
- <script>
- alert('E-mail enviado com sucesso!');
- window.location.href='index.html';
- </script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement