mail () ku-PHP nge-UTF-8 nama-umlauts

Ukuthumela ama -imeyili nge-PHP kusetshenziswa kangcono ngamakilasi anamandla afana ne- PHPMailer . Imisebenzi esongelayo elula yenza kube nokwenzeka ukusebenzisa okuqukethwe kwe-UTF-8, ukushumeka izithombe nokuthumela okunamathiselwe okubethelwe ngemigqa embalwa yekhodi. Uma ufuna ukuzisindisa ngaphezulu futhi, ngokungafani nesincomo, sebenzisa i-PHP function mail () , uzohlangabezana nezinkinga lapho usebenzisa ama-umlauts ne-UTF-8 kamuva nje.


Ngemuva kokubiza umsebenzi nge

mail(
   "vieldav@gmx.de",                          // Empfänger
   "ä ö ü ß",                                 // Betreff
   "ä ö ü ß",                                 // Inhalt
   "From: ä ö ü ß <david@vielhuber.de>"       // Header (Absender)
);

kufayela elifakiwe le-UTF-8 selivele liholela ezinkingeni kubhokisi lokungenayo: I-Outlook 2013 isenomusa futhi ikhombisa konke kahle:

imeyili1

Kepha i-GMX ayizixoleli izihloko ezingekho futhi ikhombisa isihloko esibi, umthumeli nokuqukethwe:

imeyili2

Uma uthumela izihloko ezifanele (ngokwesibonelo nge-base64_encode), uthola

mail(
   "vieldav@gmx.de",                          				  // Empfänger
   "=?UTF-8?B?".base64_encode("ä ö ü ß")."?=",                            // Betreff
   "ä ö ü ß",                                 			 	  // Inhalt
   "Content-type: text/plain; charset=utf-8\r\n"
  ."From: =?UTF-8?B?".base64_encode("ä ö ü ß")."?=<david@vielhuber.de>"   // Header (Absender)
);

futhi ekugcineni i-GMX ikhombisa ukumelwa okulungile:

imeyili3

Emuva