php - PHPMailer 的阿拉伯语问题

标签 php encoding phpmailer

我正在使用 PHPMailer 并尝试发送带有阿拉伯语文本的电子邮件,它正在发送空主题,我可以在我的收件箱中看到“(无主题)”

我正在使用以下内容:

HTML代码

<form action="mail.php" method="post">
<input type="text" name="subject" />
<input type="submit" value="Send" />
</form>

PHP 代码 (mail.php)

$subject = $_POST["subject"];
    $mailer = new PHPMailer();
            $mailer->CharSet = 'UTF-8';
            $mailer->IsSMTP();
            $mailer->SMTPDebug = 1;
            $mailer->SMTPAuth = true;



            // Prepare Message  
            $mailer->Subject = ($subject);
            $emails = 0;

帮助将不胜感激:)

最佳答案

只需添加

$mailer->CharSet = 'UTF-8';

和它的作品

关于php - PHPMailer 的阿拉伯语问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15592687/

相关文章:

php - 无法连接到 SMTP 主机

javascript - 首次登录时的 React-Native 欢迎屏幕

php - sybase 到 php 的编码问题

php - OAuth2 如何确定重定向 uri 是否使用 tls?

java - MSSQL中的编码问题

Python UTF-16 WAVY DASH 编码问题/问题

php - 通过 PHPmailer 发送 HTML 表格

php - SMTP 不适用于 php 邮件程序类

php - 从 WooCommerce 主侧边栏中删除元素符号点

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP