6
I made a short form to send e-mail. But when I do the sending test nothing arrives in the destination email. As I do not have much experience in this part I could not identify the error, since when sending does not give any. Follow my HTML:
<!doctype html>
<html lang="pt-br">
<head>
<? include "includes/head.php"?>
</head>
<body>
<div id="site">
<div class="container">
<section class="contato">
<? include "includes/topo.php"?>
<div class="envolve">
<h2>CONTATO</h2>
<div>
<p>Preencha o formulário</p>
<form id="form1" name="form1" method="post" action="mail.php">
<input type="text" name="nome" placeholder="Nome:" required>
<input type="email" name="email" placeholder="E-mail:" required>
<input type="tel" name="telefone" placeholder="Telefone:" required>
<input type="text" name="estado" placeholder="Estado:" required>
<textarea name="mensagem" placeholder="Mensagem:"></textarea>
<input type="submit" name="enviar" value="Enviar">
</form>
</div>
<div>
<p>Av. Sumare, 1642 - Sumare - SP</p>
<p><strong>Contratação de artistas</strong></p>
<p>(11) 2977-5177</p>
<span class="fr">
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d3657.666898030628!2d-46.676697399999995!3d-23.544480200000002!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x94ce578cc9a3c755%3A0xe7e810c950cee00b!2sAv.+Sumar%C3%A9%2C+1642+-+Sumar%C3%A9%2C+S%C3%A3o+Paulo+-+SP%2C+01252-120!5e0!3m2!1spt-BR!2sbr!4v1423246864426" width="412" height="298" frameborder="0" style="border:0"></iframe>
</span>
</div>
</div>
</section>
</div>
<? include "includes/rodape.php"?>
</div>
</body>
</html>
My PHP code:
$para = "[email protected]";
$assunto = "Contato pelo site";
$nome = $_POST['nome'];
$email = $_POST['email'];
$telefone = $_POST['telefone'];
$estado = $_POST['estado'];
$mensagem = $_POST['mensagem'];
$corpo = "<strong>Mensagem de contato<br><br></strong>";
$corpo .= "<strong>Nome:</strong>$nome";
$corpo .= "<br><strong>E-mail:</strong>$email";
$corpo .= "<br><strong>Telefone:</strong>$telefone";
$corpo .= "<br><strong>Estado:</strong>$estado";
$corpo .= "<br><strong>Mensagem:</strong>$mensagem";
$header .= "Content-Type: text/html; charset= utf-8\n";
$header = "From: $email Reply-to: $email\n";
@mail($para,$assunto,$corpo,$header);
header("location:contato.php?msg=enviado");
Look in the recipient’s SPAM box as you are using mail function. Anything is possible.
– Lollipop
I recommend my reply, to send email by SMTP: http://answall.com/questions/45556/funcao-mail-no-php/45568#45568
– Lollipop
mail
returnstrue
orfalse
. Then use this to your advantage. However, as stated in my reply http://answall.com/a/45558/3635 it is not possible to verify that the e-mail has reached the recipient, only that it has reached the e-mail server service. But as you said @Qmechanic73 may be some error in your code that you have hidden.– Guilherme Nascimento
Lollipop this was the first thing I did I looked in all of the mailboxes, as for the link you went through from phpmailer, they serve for all the servers? For example the server I am testing is from Locaweb. Qmechanic had already tested without the @ error
– user4451
if my code is correct, then the problem is the configuration of the server?
– user4451
William as I had already told Qmechanic does not give any error when I take the @ simply writes sent in the url but does not send any email
– user4451
Wait a minute, you said the form data doesn’t go to the email, so that means you get the email, but it comes without the completed data? Or do you not even receive the email? And please you did the test of TRUE and FALSE I said?
– Guilherme Nascimento
@Guilherme Nascimento, the data is sent in the url but nothing comes to the email, as for that test to take @, I’ve done it and there is no mistake
– user4451
Appears as sent by which you added a redirect. You should use TRUE/FALSE with IF something like: if(mail()) { header(); } Else { echo 'error'; }, if even so the page redirects, then your problem is not with PHP but with Antispam or something like that.
– Guilherme Nascimento
check your hosting provider’s email submission standards.. most do not allow direct sending without authentication or through specific settings. Then refer to your hosting provider’s documentation and support.
– Daniel Omine
@user4451 goes to phpmailer. With it you set up an email account for sending and it is not dependent on each server where your app will run.
– Rafael Mena Barreto