Mam następujący problem: po wysłaniu za pomocą funkcji mail() emaila, którego treść pochodzi z formularza kontaktowego, dostaję na skrzynkę treść, bez polskich znaków. Wiem, że problem tkwi gdzieś w kodowaniu.
oto skrypt:
<?php ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <meta http-equiv="content-language" content="pl" /> </head> <?php $imie=$_POST['imie']; $email=$_POST['email']; $tresc=$_POST['tresc']; $ID=$_POST['ID']; if (($imie=="")||($email=="")||($tresc=="")||($ID=="")) { } else{ $sprawdz=$_SESSION['captcha']; $kod = $_POST['ID']; if ($kod==$sprawdz) { $poprawny_email=filter_var($email, FILTER_VALIDATE_EMAIL); if ($poprawny_email!="") { $to = "wujekkk@vp.pl"; $subject = "Zapytanie wysłane ze strony biblioteki"; $message = "Pan/Pani ".$imie." Napisał/Napisała: \n \n".$tresc; $headers = "MIME-Version: 1.0"; $headers .= "Content-type: text/html; charset=iso-8859-2"; $headers = "From: " . $email . "\n" . "Return-Path: " . $email . "\n" . "Reply-To: " . $email . "\n"; if ($submit) else } else { } } else { } } ?> </html>
a oto formularz:
Dodam, że wyświetlając 'echem' $tresc w skrypcie wszystko jest ok, tzn są polskie znaki.
Pomożecie??
Problem rozwiązałem sam. Temat do zamknięcia!
<?php ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <meta http-equiv="content-language" content="pl" /> </head> <?php $imie=$_POST['imie']; $email=$_POST['email']; $tresc=$_POST['tresc']; $ID=$_POST['ID']; if (($imie=="")||($email=="")||($tresc=="")||($ID=="")) { } else{ $sprawdz=$_SESSION['captcha']; $kod = $_POST['ID']; if ($kod==$sprawdz) { $poprawny_email=filter_var($email, FILTER_VALIDATE_EMAIL); if ($poprawny_email!="") { $to = "wujekkk@vp.pl"; $subject = "Zapytanie wysłane ze strony biblioteki"; $message = "Pan/Pani ".$imie." Napisał/Napisała: \r\n \r\n".$tresc; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=ISO-8859-2\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers.= "From: " . $email . "\n" . "Return-Path: " . $email . "\n" . "Reply-To: " . $email . "\n"; if ($submit) else } else { } } else { } } ?> </html>