проблема с электронной почтой HTML на pear_mime / Pear_Mail - PullRequest
0 голосов
/ 14 мая 2019

У меня проблема, я использую функции Pear_mail и Mail_mime для отправки почты с вложением, все нормально работает с gmail, но на адресах * live.com и * mail.ru у меня проблема, что кодировка не работает, IDK, с чего начать.

Пытался изменить параметры Юникода, но не повезло.

$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 Кодирование передачи содержимого: цитируемый для печати Тип содержимого: text / 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 = А5 = Е1 = 83 = А1 = Е1 = 83 = 98 = Е1 = 83 = А0 = Е1 = 83 = 93 = Е1 = 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 =Е1 = 83 = 90 = Е1 = 83 = 9D = Е1 = 83 = 91 = Е1 = 83 = 90 = Е1 = 83 = 96 = Е1 = 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>");
}

1 Ответ

0 голосов
/ 14 мая 2019

Решено, Удалено 'text / html; charset = utf-8' и все в порядке ...

...