just trying to find out why my code is not working. Of course I replaced the mail adress with my valid e-mail. Do you have a clue?
The form seems to work but the problem is, that I do not get any mails in my inbox.
This is the HTML-Part:
<form id="contact-form">
<p id="contact-form-success" class="form-success-message column-container align-center">
<strong><i class="fa fa-check-square-o"></i> Ihre Anfrage wurde verschickt!</strong><br>
Text Text
</p>
<div class="column-container formFields">
<div class="column one-half"><p><input id="contact-name" class="required" name="contact-name" type="text" placeholder="Vorname"></p>
<p><input id="contact-name-last" class="required" name="contact-name-last" type="text" placeholder="Nachname"></p>
</div>
<div class="column one-half last">
<p><input id="contact-email" class="required" name="contact-email" type="email" placeholder="E-Mail"></p>
<p><input id="contact-phone" name="contact-phone" type="tel" placeholder="Telefon (optional)"></p>
</div>
</div>
<br/>
<p class="submit formFields"><button class="form-submit button grey" type="submit">Angebot anfordern</button></p>
</form>
The PHP-Part:
<?php
$email = "myname@mail.de";
$subject = "[Auftrag+] Angebot Anfrage";
if ( isset($_POST["contact-name"]) && isset($_POST["contact-name-last"]) && isset($_POST["contact-email"]) ) {
$name = htmlentities($_POST["contact-name"], ENT_QUOTES, "UTF-8");
$name_last = htmlentities($_POST["contact-name-last"], ENT_QUOTES, "UTF-8");
$email = htmlentities($_POST["contact-email"], ENT_QUOTES, "UTF-8");
$phone = htmlentities($_POST["contact-phone"], ENT_QUOTES, "UTF-8");
$ip = $_SERVER['REMOTE_ADDR'];
$to = $email;
$subject = $subject;
$message =
<<<HTML
Name: {$name}
Nachname: {$name_last}
Email: {$email}
Phone: {$phone}
IP: {$ip}
HTML;
$headers = "From:" . $email;
mail( $to, $subject, $message, $headers );
echo "Success";
} else {
echo "POST request does not contain necessary data!";
}