-1

我不明白我做错了什么。我有一个使用此代码发送消息的联系表:

$SUCCESS = mail(

    $EMAIL_TO,

    "Richiesta informazioni",

    "Questo messaggio e' stato inviato tramite la pagina 'Contatti' del sito ".$WEBSITE."; non rispondere a questo messaggio ma servirsi dei contatti lasciati dal mittente.\r\n\r\n".
    "Inviato da: ".$_POST['nome']."\r\n".
    "IP Address: ".$_SERVER['REMOTE_ADDR']."\r\n".
    "Contatti: ".$_POST['contatti']."\r\n".
    "------------------------------------------------------\r\n".
    $_POST['messaggio']."\r\n",

    "Reply-To: ".$COMPANY." <".$EMAIL_TO.">\r\n".
    "Return-Path: ".$COMPANY." <".$EMAIL_TO.">\r\n".
    "From: ".$COMPANY." <".$WEBSITE.">\r\n".
    "Organization: ".$COMPANY."\r\n".
    "MIME-Version: 1.0\r\n".
    "Content-type: text/plain; charset=utf-8\r\n".
    "Content-Transfer-Encoding: 8bit",

    "-f".$EMAIL_TO

);

问题是,如果我发送特殊字符......

¡
¢
£
¤
¥

...我收到翻译的字符:

&Acirc;&iexcl;
&Acirc;&cent;
&Acirc;&pound;
&Acirc;&curren;
&Acirc;&yen;

当然,我已经尝试了很多其他讨论中建议的解决方案:

// it's just a list - not the code I used! I've tryed lots of combinations.
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "ISO-8859-1");
htmlspecialchars(...);
mb_convert_encoding(...);

我只用mb_convert_encoding获得了一个结果:

$message = mb_convert_encoding($message, 'UTF-8', 'HTML-ENTITIES');

但这不是一个明确的解决方案,因为如果我使用这个函数,我会得到:

¡
¢
£
¤
Â¥

很抱歉,这个问题对社区没有用!不幸的是,我的想法用完了,我需要帮助......我错过了什么???

4

1 回答 1

0

改变标题:

 "Content-Type: text/plain; charset=UTF-8\n";

 "Content-Type: text/html; charset=UTF-8\n";

下面的代码我已经改变了你可以添加n检查

"Reply-To: ".$COMPANY." <".$EMAIL_TO.">\r\n".
"Return-Path: ".$COMPANY." <".$EMAIL_TO.">\r\n".
"From: ".$COMPANY." <".$WEBSITE.">\r\n".
"Organization: ".$COMPANY."\r\n".
"MIME-Version: 1.0\r\n".
"Content-Type: text/html; charset=UTF-8\r\n".
"Content-Transfer-Encoding: 8bit",

"-f".$EMAIL_TO

我检查了下面的代码及其工作

<?php
mail(

    "check with ur email",

    "Richiesta informazioni",

    "Questo messaggio e' stato inviato tramite la pagina 'Contatti' del sito; non rispondere a questo messaggio ma servirsi dei contatti lasciati dal mittente.\r\n\r\n".
    "Inviato da: santanu\r\n".
    "IP Address: santanu\r\n".
    "Contatti: santanu\r\n".
    "------------------------------------------------------\r\n
    message ¡
¢
£
¤
¥\r\n",

    "Reply-To: test <your email>\r\n".
    "Return-Path: test<your email>\r\n".
    "From: test <your email>\r\n".
    "Organization: test\r\n".
    "MIME-Version: 1.0\r\n".
    "Content-type: text/html; charset=utf-8\r\n".
    "Content-Transfer-Encoding: 8bit",

    "-fyour email"

);

?>
于 2013-05-23T13:12:11.163 回答