Witam,

Wy edytowałem formularz kontaktowy z neta i niestety nie brakuję mu polskich znaków w przychodzącej wiadomości.

  1. <?php
  2. $names = $_POST['names'];
  3. $email = $_POST['email_address'];
  4. $comment = $_POST['comment'];
  5. $to ='szymondziewonski@gmail.com';
  6.  
  7. $message = "";
  8. $message .= "Name: " . htmlspecialchars($names, ENT_QUOTES) . "<br>\n";
  9. $message .= "Email: " . htmlspecialchars($email, ENT_QUOTES) . "<br>\n";
  10. $message .= "Comment: " . htmlspecialchars($comment, ENT_QUOTES) . "<br>\n";
  11. $lowmsg = strtolower($message);
  12.  
  13. $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n";
  14. $headers .= "From: \"" . $names . "\" <" . $email . ">\r\n";
  15. $headers .= "Reply-To: " . $email . "\r\n";
  16. $message = utf8_decode($message); mail($to, "EMCD - Feedback", $message, $headers);
  17.  
  18. if ($message){
  19. echo 'sent';
  20. }else{
  21. echo 'failed';
  22. }
  23. ?>


Próbowałem również zamieniać
  1. $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n";

na
  1. $headers .= "Content-Type: text/plain; charset = \"UTF-8\";\n";
  2. $headers .= "Content-Transfer-Encoding: 8bit\n";
  3. $headers .= "\n";


Niestety wtedy wiadomość nie przychodziła w ogóle.

Tutaj przesyłam dalszą część kodu formularza.


  1. $(document).ready(function(){
  2. $('#submit-form').click(function(){
  3.  
  4. var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  5. var names = $('#contact-form [name="contact-names"]').val();
  6. var email_address = $('#contact-form [name="contact-email"]').val();
  7. var comment = $.trim($('#contact-form .contact-commnent').val());
  8. var data_html ='' ;
  9.  
  10.  
  11. if(names == ""){
  12. $('#name-required').html('Your name is required.');
  13. }else{
  14. $('#name-required').html('');
  15. }
  16. if(email_address == ""){
  17. $('#email-required').html('Your email is required.');
  18. }else if(reg.test(email_address) == false){
  19. $('#email-required').html('Invalid Email Address.');
  20. }else{
  21. $('#email-required').html('');
  22. }
  23.  
  24. if(comment == ""){
  25. $('#comment-required').html('Comment is required.');
  26. }else{
  27. $('#comment-required').html('');
  28. }
  29.  
  30. if(comment != "" && names != "" && reg.test(email_address) != false){
  31.  
  32. data_html = "names="+ names + "&comment=" + comment + "&email_address="+ email_address;
  33.  
  34. //alert(data_html);
  35.  
  36. $.ajax({
  37. type: 'POST',
  38. url: 'contact-send.php',
  39. data: data_html,
  40. success: function(msg){
  41. if (msg == 'sent'){
  42. $('#success').html('Message sent!') ;
  43. $('#contact-form [name="contact-names"]').val('');
  44. $('#contact-form [name="contact-email"]').val('');
  45. $('#contact-form .contact-commnent').val('');
  46. }else{
  47. $('#success').html('Mail Error. Please Try Again.!') ;
  48. }
  49. }
  50. });
  51.  
  52. }
  53.  
  54. return false;
  55. })
  56. })
  57.  
  58.  



  1. <div class="form-wrapper">
  2. <h1 id="success"></h1>
  3. <h1>Feedback</h1>
  4. <form id="contact-form" name="contact-form" method="POST">
  5. <p>What is your name?</p><br/>
  6. <p><input type="text" value="" name="contact-names" class="contact-names"/>
  7. </p>
  8. <h6 id="name-required"></h6><br/>
  9. <p>Where can we email you back?</p><br/>
  10. <p><input type="text" value="" name="contact-email" class="contact-email"/>
  11.  
  12. <h6 id="email-required"></h6></p><br/>
  13. <p>What's on your mind?</p>
  14. <p><br/>
  15. <textarea class="contact-commnent" name="comments"></textarea>
  16. <h6 id="comment-required"></h6></p><br/>
  17.  
  18. <p id="p-submit">
  19. <input id="submit-form" class="submit-button" name="submit" type="submit" value="Submit"></p>
  20. </form>
  21. </div>



PROSIŁBYM BARDZO O POMOC! smile.gif