Last updated: August 28, 2026.
Names, subjects, and bodies can contain characters outside ASCII. Use UTF-8 for the complete message and let the mail library apply the required transfer encoding.
Set the message character set
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer(true);
$mail->CharSet = PHPMailer::CHARSET_UTF8;
$mail->Encoding = PHPMailer::ENCODING_BASE64;
$mail->setFrom('[email protected]', 'Cafe Example');
$mail->addAddress('[email protected]', 'Zoe');
$mail->Subject = 'Resume received';
$mail->Body = 'Your message was received.';
// Configure SMTP, then call $mail->send().Keep data UTF-8 end to end
- Save PHP source files as UTF-8.
- Use utf8mb4 for database text.
- Avoid unnecessary encoding conversions.
- Test accented text, non-Latin scripts, and emoji.
Reference: PHPMailer official repository.