我目前为日本客户工作,他在接收通过其用PHP构建的联系表发送的电子邮件时遇到问题。
经调查,由于最近几个月来困扰我的问题莫吉巴克(Mojibake),似乎每次都会触发邮件服务器的反垃圾邮件。
X-Spam-Status: Yes, score=9.6 required=7.0 tests=FROM_ILLEGAL_CHARS,
HTML_MESSAGE,HTML_MIME_NO_HTML_TAG,MIME_HTML_ONLY,MISSING_MIMEOLE,RDNS_NONE,
SUBJECT_NEEDS_ENCODING,SUBJ_ILLEGAL_CHARS autolearn=no version=3.2.5
X-Spam-Report:
* 4.0 FROM_ILLEGAL_CHARS From: has too many raw illegal characters
* 1.5 SUBJ_ILLEGAL_CHARS Subject: has too many raw illegal characters
* 0.0 HTML_MESSAGE BODY: HTML included in message
* 1.7 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
* 1.3 SUBJECT_NEEDS_ENCODING SUBJECT_NEEDS_ENCODING
* 1.1 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag
* 0.0 MISSING_MIMEOLE Message has X-MSMail-Priority, but no X-MimeOLE
* 0.1 RDNS_NONE Delivered to trusted network by a host with no rDNS
即使:
我也尝试使用neitanod的toUTF8 library,但是它没有任何改变,我仍然收到强制编码为Latin1的UTF-8外观
X-Antivirus: avast (VPS 18071604)
X-Antivirus-Status: Clean
Return-Path: <ap-50728@example.com>
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
vts18.digitalink.ne.jp
X-Spam-Level: ******
X-Spam-Status: No, score=6.2 required=7.0 tests=AWL,HTML_MESSAGE,
HTML_MIME_NO_HTML_TAG,MIME_HTML_ONLY,MISSING_SUBJECT,RDNS_NONE,
SUBJ_ILLEGAL_CHARS autolearn=no version=3.2.5
X-Original-To: xxx@example.com
Delivered-To: xxx@example.com
Received: from vts18.digitalink.ne.jp (unknown [127.0.0.1])
by vts18.digitalink.ne.jp (Postfix) with ESMTP id C38AD11069044
for <xxx@example.com>; Tue, 17 Jul 2018 07:23:43 +0000 (UTC)
Received: from www.cosmetic-aida.jp (unknown [182.93.127.172])
by vts18.digitalink.ne.jp (Postfix) with ESMTP
for <xxx@example.com>; Tue, 17 Jul 2018 07:23:43 +0000 (UTC)
X-Alpha-Mail-Premier: web2008
Received: by example.com (Postfix, from userid 48)
id 8072F95D0EF1; Tue, 17 Jul 2018 16:23:46 +0900 (JST)
To: xxx@example.com
Subject: =?UTF-8?B?æååãã¡ã¼ã«?=
From: webmaster@example.com
Reply-To: webmaster@example.com
MIME-Version: 1.0
X-Mailer: PHP/5.3.3
Content-type: text/html; charset=UTF-8
Message-Id: <20180717072346.8072F95D0EF1@www.cosmetic-aida.jp>
Date: Tue, 17 Jul 2018 16:23:46 +0900 (JST)
ãä¸äººæ®ããã§ããææã¾ã§å¤ç«ããçããã«ã¯ãã©ããªãã¨ãå¿ããããããã®ã§ãããããéºåæ´çå°éä¼ç¤¾ãç«ã¡ä¸ãããå¤ç«æ»ããé¿ããããã®åçºã«ãåãçµãåç°å¤ªä¸ããã«èãã¾ããã
关于我用来生成此代码的代码,这里是
<?php
header('Content-type: text/plain; charset=utf-8');
error_reporting(E_ALL);
ini_set('mbstring.internal_encoding','UTF-8')
$msg = " 一人暮らしでも、最期まで孤立せず生きるには、どんなことを心がけたらよいのでしょうか。遺品整理専門会社を立ち上げ、「孤立死」を避けるための啓発にも取り組む吉田太一さんに聞きました。\r\n
";
$myHeaders = 'From: webmaster@example.com' . "\r\n";
$myHeaders .= 'Reply-To: webmaster@example.com' . "\r\n";
$myHeaders .= 'MIME-Version: 1.0'. "\r\n";
$myHeaders .= 'X-Mailer: PHP/' . phpversion(). "\r\n";
$myHeaders .= 'Content-type: text/html; charset=UTF-8'. "\r\n";
$mailOK = (mail(
"xxx@example.com",
"=?UTF-8?B?"."文字化けメール"."?=",
$msg,
$myHeaders
)) ? "Mail sent" : "Error sending mail";
echo $mailOK;
我追错了吗? 对于那些曾经发送过非拉丁编码字符的人,您该如何处理?
[EDIT]添加了完整的原始电子邮件和用于生成电子邮件的脚本