Witam,
Wy edytowałem formularz kontaktowy z neta i niestety nie brakuję mu polskich znaków w przychodzącej wiadomości.
<?php
$names = $_POST['names'];
$email = $_POST['email_address'];
$comment = $_POST['comment'];
$to ='szymondziewonski@gmail.com';
$message = "";
$headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n";
$headers .= "From: \"" . $names . "\" <" . $email . ">\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$message = utf8_decode
($message); mail($to, "EMCD - Feedback", $message, $headers);
if ($message){
}else{
}
?>
Próbowałem również zamieniać $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n";
na$headers .= "Content-Type: text/plain; charset = \"UTF-8\";\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "\n";
Niestety wtedy wiadomość nie przychodziła w ogóle.
Tutaj przesyłam dalszą część kodu formularza. $(document).ready(function(){
$('#submit-form').click(function(){
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var names = $('#contact-form [name="contact-names"]').val();
var email_address = $('#contact-form [name="contact-email"]').val();
var comment = $.trim($('#contact-form .contact-commnent').val());
var data_html ='' ;
if(names == ""){
$('#name-required').html('Your name is required.');
}else{
$('#name-required').html('');
}
if(email_address == ""){
$('#email-required').html('Your email is required.');
}else if(reg.test(email_address) == false){
$('#email-required').html('Invalid Email Address.');
}else{
$('#email-required').html('');
}
if(comment == ""){
$('#comment-required').html('Comment is required.');
}else{
$('#comment-required').html('');
}
if(comment != "" && names != "" && reg.test(email_address) != false){
data_html = "names="+ names + "&comment=" + comment + "&email_address="+ email_address;
//alert(data_html);
$.ajax({
type: 'POST',
url: 'contact-send.php',
data: data_html,
success: function(msg){
if (msg == 'sent'){
$('#success').html('Message sent!') ;
$('#contact-form [name="contact-names"]').val('');
$('#contact-form [name="contact-email"]').val('');
$('#contact-form .contact-commnent').val('');
}else{
$('#success').html('Mail Error. Please Try Again.!') ;
}
}
});
}
return false;
})
})
<div class="form-wrapper"> <form id="contact-form" name="contact-form" method="POST"> <p>What is your name?
</p><br/> <p><input type="text" value="" name="contact-names" class="contact-names"/> <h6 id="name-required"></h6><br/> <p>Where can we email you back?
</p><br/> <p><input type="text" value="" name="contact-email" class="contact-email"/>
<h6 id="email-required"></h6></p><br/> <p>What's on your mind?
</p> <h6 id="comment-required"></h6></p><br/>
<input id="submit-form" class="submit-button" name="submit" type="submit" value="Submit"></p>
PROSIŁBYM BARDZO O POMOC!
Ten post edytował szymon-dziewonski 14.04.2012, 11:37:47