2
I have a contact form on my website. It picks up information like name, email, phone and message. However, this data is displayed only in the administration panel of the site itself. I would like that at the time of contact the code took the e-mail informed by the user and sent a direct message to my email!
I tried to use the mail function, but I’m not getting any success! How to do this then?!
I used someone:: Such as
first.::
<?php
$nome = $_POST['nome']; echo $nome; echo "<br>";
$email = $_POST['email']; echo $email; echo "<br>";
$mensagem = $_POST['mensagem']; echo $mensagem; echo "<br>";
$corpo = "Nome: ".$nome."<BR>\n";
$corpo .= "Email: ".$email."<BR>\n";
$corpo .= "Mensagem: ".$mensagem."<BR>\n";
if(mail("[email protected]","Assunto",$corpo)){
echo("email enviado com sucesso");
} else {
echo("Erro ao enviar e-mail");
}
?>
In this example, it simply returns "error sending email", without further details.
2.::
<?php
$email_remetente = "[email protected]";
$headers = "MIME-Version: 1.1\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "From: $email_remetente\n"; // remetente
$headers .= "Return-Path: $email_remetente\n"; // return-path
$headers .= "Reply-To: $email_usuario\n"; // Endereço (devidamente validado) que o seu usuário informou no contato
$envio = mail("[email protected]", "Assunto", "Mensagem", $headers, "-f$email_remetente");
?>
The recipient will always be the same - my email - the one that will actually change will always be the subject, message and sender.
Is it possible to add the code with your attempt to question? So it’s easier for us to help with a solution.
– Paulo Rodrigues
The localhost email server has been configured?
– rray