php mail form with confirmation not sending mail
Hey all,
This is the php I have for my mail form with confirmation:
Code:
<?php
if ($_POST["action"] == "send"){
if ($_POST[name] != "" and $_POST[email] != "" and $_POST[message] != "") {
mail ("MYMAILADRESS", "contact via LenG",
"
Naam: ".$_POST['name']."
E-mail: ".$_POST['email']."
Bericht: ".$_POST['message']."
",
"From: ".$_POST['name']." <".$_POST['email'].">");
$headers[] = 'LenG';
$subject = "bevestiging mail LenG";
$msg = "
(Dit is een automatisch verzonden bericht. Gelieve hierop niet te antwoorden.)
Beste $_POST[name],
Dankje voor je interesse.
Binnen de twee werkdagen mag je een antwoord verwachten.
Voor dringende vragen, bel gerust.
Graag tot binnenkort,
Bruno
";
mail($_POST[email], $msg, implode("\r\n", $headers));
echo '<br><div style="background-color:#fff;border:2px solid #f91942;padding:20px;color:#393939;margin-bottom:50px;margin-top:-20px;width:100%;text-align:center;"><p>Dankje voor je interesse. Binnen de twee werkdagen mag je een antwoord verwachten.</p></div>';
}
else{
echo '<br><div style="background-color:#f91942;border:2px solid #fff;padding:20px;margin-bottom:50px;margin-top:-20px;width:100%;text-align:center;color:#fff;"><p>Vul alle velden in, aub. Dankje.</p></div>';
}
}
?>
And this is the html:
Code:
<form method="post" id="contactForm" action="#contact">
<input type="hidden" name="action" value="send">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" id="name" name="name" placeholder="je naam">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" id="email" name="email" placeholder="je email adres">
</div>
</div>
</div>
<div>
<textarea id="comments" name="message" placeholder="je bericht"></textarea>
</div>
<input type="submit" class="submit button" id="send" value="verzend">
</form>
For some reason the mail form seems to send the mail (the error or sent message comes up), but it doesn't arrive. No problem with my mailbox, but something in the php doesn't handle it correctly.
Any advice, please?