email - PHP e-mail displaying special chars as � -
i have searched , forth through here , google. no luck.
trying send e-mails php have following:
header("content-type: text/html; charset=utf-8"); $empfaenger = "mail@someone.com"; $mailbetreff = "subject"; $header = "mime-version: 1.0\n"; $header .= "content-type: text/html; charset=utf-8\n"; $header .= "from: "; $header .= $sender; $header .= "\n"; $header .= "straße: blabla"; mail($empfaenger, $mailbetreff, "", $header);
characters "ß" , "ä" , arrive �. contents of e-mail generated form , not know, chars uses won't replace 1 "ß" ß", obviously.
i have tried iso-8859-1 , encoding strings htmlentities(), switches outcome � Ã special chars.
in case, relevant: server runs php 5.2.7
this row should not in $header
:
$header .= "straße: blabla";
you need create $body
variable body, , add 3rd parameter of mail.
so need use code this:
header("content-type: text/html; charset=utf-8"); $empfaenger = "a@b.c"; $mailbetreff = "subject"; $header = "mime-version: 1.0\r\n"; $header .= "content-type: text/html; charset=utf-8\r\n"; $header .= "from: "; $header .= $sender; $header .= "\r\n"; $body = "straße: blabla"; mail($empfaenger, $mailbetreff, $body, $header);
note: php file encoding should utf-8 also!
Comments
Post a Comment