0

我正在使用 phpmailer 类发送电子邮件。现在,我来自欧洲,所以我们使用了重音字符...但是从我的 php 脚本中处理不好,我不知道为什么..我尝试将很多次从 utf-8 更改为 iso-8859- 1 从我的 html 表单、script.php 和 class.phpmailer.php 反之亦然。(class.phpmailer.php 默认为 iso-8859-1)

//My form.html
...
  <form action="script.php" name="contatti" method="POST" accept-charset="ISO-8859-1">

  </form>
...

//My script.php
...
  require "phpmailer/class.phpmailer.php";

  $messaggio = new PHPmailer();
  $messaggio->CharSet = "ISO-8859-1";
...


//class.phpmailer.php
...
    public $CharSet           = 'utf-8';
...

对不起我的英语不好。谢谢!

4

1 回答 1

0

编码应该在所有地方保持一致。所以让我们坚持使用 utf-8。首先检查您的网站是否是 UTF-8 编码的。你应该在你的 HTML 中寻找这样的东西:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

然后将您的“ISO-8859-1”替换为 utf-8 并查看您现在拥有的内容。

于 2012-07-28T22:44:57.770 回答