0

我有问题,我正在使用Pear_mailMail_mime功能发送带有附件的邮件,gmail 一切正常,但在 *live.com 和 *mail.ru 地址中我有编码不起作用的问题,IDK 从哪里开始。

试图更改 unicode 选项,但没有运气。

$to = "$email";
$cc = 'registration@tafu.edu.ge';
$recipients = $to.", ".$cc;

$email_subject = "Registration";
$email_body = '<html>
<head>
  <title>Registration</title>
</head>
<body>
  <p>'.$firstname.', your status has been confirmed.</p>

</body>
</html>' ;


$headers = array ('From' => $email_from, 'To' => $to, 'Subject' => $email_subject, 'Reply-To' => $email_address,     'MIME-Version' => 1, 'Content-type' => 'text/html;charset=utf-8');

$crlf = "\n";

$mime = new Mail_mime(array('eol' => $crlf));

$mime->setHTMLBody($email_body);
$mime->addAttachment($path1, 'image/jpeg');
$mime->addAttachment($path, 'image/jpeg');
$mimeparams['text_encoding']="8bit"; 
$mimeparams['text_charset']="UTF-8"; 
$mimeparams['html_charset']="UTF-8"; 
$mimeparams['head_charset']="UTF-8"; 
$email_body = $mime->get($mimeparams);
$headers = $mime->headers($headers);


$mail = $smtp->send($recipients, $headers, $email_body);


if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
}

正如我所说,gmail 上一切正常,这里是来自 live.com 的示例

--=_4e8df4505d0670b28bd8f214089c1ef5 内容传输编码:引用打印内容类型:文本/html;字符集=UTF-8 =E1=83=90=E1=83=9C=E1=83=98,=E1=83=97=E1=83=A5=E1=83=95=E1=83=94=E1 = = =83=9C=E1=83=98 =E1=83=9B=E1=83=9D=E1=83=9C=E1=83=90=E1=83=AA=E1=83=94=E1= =83=9B=E1=83=94=E1=83=91=E1=83=98 =E1=83=93=E1=83=90=E1=83=A4=E1=83=98=E1= = 83=A5=E1=83=A1=E1=83=98=E1=83=A0=E1=83=93=E1=83=90。=E1=83=9D=E1=83=A0=E1=83=98 =E1=83=A1=E1=83=90=E1=83=9B=E1=83=A3=E1=83= =A8= E1=83=90=E1=83=9D =E1=83=93=E1=83=A6=E1=83=98=E1=83=A1 =E1=83=92=E1=83= =90=E1 =83=9C=E1=83=9B=E1=83=90=E1=83=95=E1=83=9A=E1=83=9D=E1=83=91=E1=83=90= =E1= 83=A8=E1=83=98 =E1=83=97=E1=83=A5=E1=83=95=E1=83=94=E1=83=9C =E1=83=9B= =E1=83 =98=E1=83=98=E1=83=A6=E1=83=94=E1=83=91=E1=83=97 =E1=83=9E=E1=83=90= =E1=83= A1=E1=83=A3=E1=83=AE=E1=83=A1 =E1=83=A0=E1=83=94=E1=83=92=E1=83=98= =E1=83=A1 =E1=83=A2=E1=83=A0=E1=83=90=E1=83=AA=E1=83=98=E1=83=98=E1=83=A1==E1=83=97= E1=83=90=E1=83=9D=E1=83=91=E1=83=90=E1=83=96=E1=83=94。=E1=83=92=E1=83=97=E1=83=AE=E1=83=9D=E1=83=95=E1=83=97,=E1=83=92=E1= =83=90 =E1=83=93=E1=83=90=E1=83=AE=E1=83=94=E1=83=93=E1=83=9D=E1=83=97 =E1=

顺便说一句,没有附件一切都好,这是没有附件的代码

$to = $_GET['email'];
$firstname = $_GET['firstname'];
$email_subject = "Failed";
$email_body = '<html>
<head>
  <title>Failed</title>
</head>
<body>
<p>'.$firstname.', ERROR!</p>
</body>
</html>' ;


$headers = array ('From' => $email_from, 'To' => $to, 'Subject' => $email_subject, 'Reply-To' => $email_address,     'MIME-Version' => 1,    'Content-type' => 'text/html;charset=utf-8');

$mail = $smtp->send($to, $headers, $email_body);


if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
}
4

1 回答 1

0

已解决,删除 'text/html;charset=utf-8' 一切正常...

于 2019-05-14T09:53:13.387 回答