Search code examples
phphtmlcssemailphpmailer

Special "Special" Character Support HTML (in email)


I'm trying to send an email with PHP mailer, I'm reading an HTML and passing it as the body.

file_get_contents('email.html');

but when I'm receiving the mail some of the characters like © are getting converted like © “ â€.

I have <meta charset="UTF-8"/> under the body tag as well as I tried that under head tag. When I open the email.html in Safari (as a web page) or I open the email from Gmail in Safari <meta charset="UTF-8"/> seems to work, but inside Mac Mail it's not working.

screenshot

I have a CSS file linked in the HTML so if it's possible to fix that from CSS that would be great.


Solution

  • Set the character set that PHPMailer uses like this:

    $mail->CharSet = ‘utf-8’;