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"; 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.
<script> $(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; }) }) </script>
PROSIŁBYM BARDZO O POMOC!
