用php将用iso-8859-1编码的简单电子邮件发送到iphone

时间:2017-01-25 09:17:49

标签: php ios iphone encoding iso-8859-1

iOS设备接收到ISO-8859-1编码的特殊字符时遇到问题。

因此,为了理解这个问题,我创建了一个简单的PHP脚本,它发送一个非常简单的编码消息。在我的所有其他电子邮件客户端上它可以工作,但在iOS上却没有。

我需要一些帮助来修改此代码才能使其正常工作。

请不要建议使用UTF-8。我的应用程序无法切换到UTF-8,因此我想知道如何发送ISO-8859-1编码字符。

这是需要修改的代码:

<?php    
$recipient  = 'user@domain.com';
$betreff = 'special characters test';
$subject = '
<html>
<head>
  <title>special characters test</title>
</head>
<body>
  <p>Test for special characters encoded in ISO-8859-1</p>  
  <strong>ISO-8859-1:</strong> äöüÄÖÜß<br><br>
  <strong>Entities:</strong>  &auml;&ouml;&uuml;&Auml;<br><br>
</body>
</html>
';
$header  = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if (mail($recipient, $betreff, $subject, $header)) 
  echo "email has been sent.";
?>

0 个答案:

没有答案