Skip to content

Instantly share code, notes, and snippets.

@rafa-acioly
Last active November 6, 2015 12:59
Show Gist options
  • Save rafa-acioly/fff9daac489aebbfa0f2 to your computer and use it in GitHub Desktop.
Save rafa-acioly/fff9daac489aebbfa0f2 to your computer and use it in GitHub Desktop.
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$remetente = "contato@x.ws";
$destinatario = "contato@y.com.br";
$nome = $_POST['nome'];
$empresa = $_POST['empresa'];
$email = $_POST['email'];
$telefone = $_POST['telefone'];
$assunto = $_POST['assunto'];
$mensagem = $_POST['mensagem'];
$corpo = '
Nome: '.$nome.'
Empresa:: '.$empresa.'
Email: '.$email.'
Telefone: '.$telefone.'
Assunto: '.$assunto.'
Mensagem: '.$mensagem.'';
$headers = "MIME-Version: 1.1\n";
$headers .= "Content-type: text/plain; charset=UTF-8\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: " . $remetente . "\r\n";
$headers .= "Suporte \n";
$headers .= "Responda para: " . $email . "\n";
$headers .= "Return-Path: " . $remetente . "\n";
$headers .= "<img src='' alt=''/>"
if (mail($destinatario, "Contato via formulario - site", $corpo, $headers, "-r" . $remetente)) {
echo "<script>alert('Enviado com sucesso!'); location.href='http://y.com.br/contato';</script>";
} else {
echo "<script>alert('Ocorreu um Erro ao enviar a mensagem!');</script>";
}
?>
<html lang="pt">
<head>
<meta charset="utf-8" />
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment