Mam problem ze skryptem PHP, który ma za zadanie wysyłać maile. Gdy wypełnię formularz i klikam ?Wyślij? to maile nie dochodzą na moją skrzynkę. Kod PHP wygląda tak:
CODE
<?php
if(isset($_POST['url']) && $_POST['url'] == '' && $_POST['message'] != ''){
$youremail = 'przykladowyemail@poczta.pl';
$body = "Formularz kontaktowy:
Imię: $_POST[firstname]
Nazwisko: $_POST[lastname]
E-Mail: $_POST[email]
Wiadomość: $_POST[message]";
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
mail($youremail, 'Kontakt', $body, $headers );
}
header('http://www.mojastrona.pl/');
exit('http://www.mojastrona.pl/');
?>
if(isset($_POST['url']) && $_POST['url'] == '' && $_POST['message'] != ''){
$youremail = 'przykladowyemail@poczta.pl';
$body = "Formularz kontaktowy:
Imię: $_POST[firstname]
Nazwisko: $_POST[lastname]
E-Mail: $_POST[email]
Wiadomość: $_POST[message]";
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
mail($youremail, 'Kontakt', $body, $headers );
}
header('http://www.mojastrona.pl/');
exit('http://www.mojastrona.pl/');
?>
Kod HTML wygląda tak:
CODE
<label for="fname">Imię</label>
<input type="text" name="firstname" placeholder="Twoje imię">
<label for="lname">Nazwisko</label>
<input type="text" name="lastname" placeholder="Twoje nazwisko">
<label for="lname">Email</label>
<input type="text" name="email" placeholder="Twój email">
<label for="message">Wpisz swoją wiadomość</label>
<textarea id="message" name="message" placeholder="Treść wiadomości..." style="height: 200px"></textarea>
<input type="submit" value="Wyślij">
<p class="antispam">Zostaw to pole puste - ochrona przed spamem
<br /><input name="url" /></p>
<input type="text" name="firstname" placeholder="Twoje imię">
<label for="lname">Nazwisko</label>
<input type="text" name="lastname" placeholder="Twoje nazwisko">
<label for="lname">Email</label>
<input type="text" name="email" placeholder="Twój email">
<label for="message">Wpisz swoją wiadomość</label>
<textarea id="message" name="message" placeholder="Treść wiadomości..." style="height: 200px"></textarea>
<input type="submit" value="Wyślij">
<p class="antispam">Zostaw to pole puste - ochrona przed spamem
<br /><input name="url" /></p>
Kod CSS:
CODE
.antispam { display:none;}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical
}
input[type=submit] {
background-color: grey;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: grey;
}
.contact {
border-radius: 5px;
background-color: #f4f4f4;
padding: 20px;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical
}
input[type=submit] {
background-color: grey;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: grey;
}
.contact {
border-radius: 5px;
background-color: #f4f4f4;
padding: 20px;
}
Oryginalny skrypt pochodzi z tego linka i mimo że robię wszystko zgodnie z instrukcją to nie działa - https://www.nfriedly.com/techblog/2009/11/h...thout-captchas/
W czym tkwi problem? Będę wdzięczny za pomoc
