php - 货币符号在电子邮件中无法正确显示

标签 php html phpmailer html-email

我正在为我的网站设置电子邮件。当我发送显示订阅价格的试用提醒电子邮件时,收到的电子邮件显示的价格不正确。这是电子邮件的代码模板:

$message = '<html><head><meta charset="UTF-8"></head>';
$message .= '<body style="text-align: center">';
$message .= '<div style="padding: 30px; margin: 0 auto; display: block; background: lightslategray; height: 500px; ">';
$message .= '<div style="width: 80%; margin: 0 auto; display: block; background: white; height: 440px; padding: 30px ">';
$message .= '<div style="background-color: #343a40" >';
$message .= '<div style="padding: 10px ">';
$message .= '<div href="" style="font-size: 23px;text-align: center; color: orange; margin: 0 5px;padding-bottom: 10px;border-bottom: 1px solid lightgrey; ">';
$message .= '<a   style="color: orange;text-decoration: none;"></a>';
$message .= '</div>';
$message .= '</div>';
$message .= '</div>';

$message .= '<h2>Your Trial Ends In 1 Week </h2><br>';
$message .= '<p>Subcriptions are £10 Per Year $  €</p>';

$message .= '<br>';
$message .= '<br>';
$message .= '<br>';
$message .= '<br>';
$message .= '<p>For help or if you have any questions, <a href="">contact us or visit the FAQ section</a></p>';
$message .= '<a title="Follow us on Facebook" target="_blank" href=">Follow Us On Facebook</a>';


$message .= '</div>';
$message .= '</div>';
$message .= "</body></html>";

问题部分是订阅价格。美元符号在电子邮件中显示正确,但英镑和欧元显示如图所示。

想知道是否有人可以帮我解决这个问题。谢谢

enter image description here

最佳答案

您不需要使用 HTML 实体 - 而且它们无论如何都无法在纯文本电子邮件中使用。完成这项工作的最简单方法是:

$mail->CharSet = 'utf-8';

然后您可以按原样使用文本,无需任何编码。

关于php - 货币符号在电子邮件中无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67452188/

相关文章:

php - Laravel 4 中 File::mime() 的替换(从文件扩展名获取 mime 类型)

javascript - CodeIgniter - 使用 setInterval 自动从数据库获取数据

javascript - 用文本框输入替换 php 变量

php - Hotmail账户收不到Godaddy发来的邮件

php - 我的数据库无法保存我的网站中通过php发送到数据库的电子邮件

php - 全局 php 文件

html - 使用 Bootstrap 4 进行特殊重新排序

javascript - 屏幕调整大小功能 - Jquery

PHPMailer - 重复变量

php - 如何防止通过 PHP mail() 发送的邮件变成垃圾邮件?