Send Email with utf-8 characters on the subject

 
<?php

$to = 'recipient@example.com';
$message = "This is the content of this test email.";
$headers = "From: sender@example.com\r\nReply-To: sender@example.com";

$subject = "This is the subject \xf0\x9f\x8f\x94";

$subject = '=?utf-8?B?' . base64_encode($subject) . '?=';

mail($to, $subject, $message, $headers);

?>

 

Related Snippets

•  HTTP Headers to Download a File
•  Set time limit indefinitely
•  Send Email with Attachment
•  Send Email in Html and Plain Text formats
•  Send Email in Html format