I have a problem with sending mail from php code. I want to use polish characters in email message. I searched many post on stack with the same problem but nothing works.
<?php
if(isset($_POST['submit'])){
$to = "...@gmail.com";
$from = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$subject = "Wiadomość ze strony";
$message = "Imię i Nazwisko: " . $name . "\nTelefon kontaktowy: " . $phone . "\n\nTreść wiadomości:" . "\n\n" . $_POST['msg'];
$headers = "From: $from \r\n".
"MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=UTF-8" . "\r\n";
mail($to,$subject,$message,$headers);
header('Location: index.html');
}
?>
I have asked my friend to check on his vps and this code work correctly. So there must be a problem with server. I use linuxpl.com.
I found the solution. Polish characters work fine when I added this line in html form.
accept-charset="ISO-8859-1"