PHP E-Mail Encoding?
As far as I know PHP does not support UTF-8 as default encoding for its strings. You need to use the relevant encoding/handling functions for the encoding you would prefer.
Also add a Content-Type:text/html;charset=utf-8
to your email headers so the email clients will display the characters correctly (or replace with your encoding of choice).
PHP send email message coding in utf-8
mail($to,utf8_decode($subject),utf8_decode($message),utf8_decode($headers));
php mail special characters utf8
Did you try iconv_set_encoding ?
This should work :
<?php
iconv_set_encoding("internal_encoding", "UTF-8");
$subject = "Testmail — Special Characters";
$msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";
mail(utf8_decode($to), utf8_decode($subject), utf8_decode($msg), utf8_decode($from)."\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");?>
Php email sent with issues on subject chars in Outlook only
The only reliable way to send e-mail is using plain 7 bit ASCII so you need to encode strings properly when you want to use anything else. In your case, [WEBSITE] áccent – tésts
should be encoded as (e.g.) =?windows-1252?B?W1dFQlNJVEVdIOFjY2VudCCWIHTpc3Rz?=
, where the string splits as:
=?windows-1252?B?W1dFQlNJVEVdIOFjY2VudCCWIHTpc3Rz?=
^ ^ ^
| | |
Charset | Data
|
Base64
Check:
echo base64_decode('W1dFQlNJVEVdIOFjY2VudCCWIHTpc3Rz'); // [WEBSITE] áccent – tésts
This is just an example of one of the possible ways to encode non-ASCII strings.
When sending e-mail, there are many little details like this that need attention. That's why sooner or later you end up using a proper e-mail package like Swift Mailer or PHPMailer.
Related Topics
How to Enable and Use Http Put and Delete with Apache2 and PHP
Excel Date Conversion Using PHP Excel
How to Call a Controller Function Inside a View in Laravel 5
PHP _Php_Incomplete_Class Object with My $_Session Data
Laravel 5.4 Field Doesn't Have a Default Value
Multiple Submit Buttons PHP Different Actions
Tcpdf Utf-8 Symbols Not Showing Up
Http_Build_Query with Same Name Parameters
Apache Mod Rewrite for Laravel
Notice: Undefined Offset: 0 In
Php: Get N-Th Item of an Associative Array
How to Pass Parameters by Reference Using Call_User_Func_Array()
How to Delete $_Post Variable Upon Pressing 'Refresh' Button on Browser with PHP
PHP Namespace with Dynamic Class Name
PHP What Is the Best Approach to Using Xml? Need to Create and Parse Xml Responses