2
0

Zend_Mail-Encoding.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.mail.encoding">
  4. <title>Encoding</title>
  5. <para>
  6. Text and HTML message bodies are encoded with the quotedprintable mechanism by default. Message headers
  7. are also encoded with the quotedprintable mechanism if you do not specify base64 in <code>setHeaderEncoding()</code>.
  8. All other attachments are encoded via base64 if no other encoding is given in the <code>addAttachment()</code>
  9. call or assigned to the MIME part object later. 7Bit and 8Bit encoding currently only pass on the
  10. binary content data.
  11. </para>
  12. <para>
  13. Header Encoding, especially the encoding of the subject, is a tricky topic. Zend_Mime currently implements
  14. its own algorithm to encode quoted printable headers according to RFC-2045.
  15. This due to the problems of <code>iconv_mime_encode</code> and <code>mb_encode_mimeheader</code>
  16. with regards to certain charsets. This algorithm only breaks the header at spaces, which might lead to headers
  17. that far exceed the suggested length of 76 chars. For this cases it is suggested to switch to BASE64
  18. header encoding as the following example describes:
  19. </para>
  20. <programlisting language="php"><![CDATA[
  21. // By default Zend_Mime::ENCODING_QUOTEDPRINTABLE
  22. $mail = new Zend_Mail('UTF-8');
  23. // Reset to Base64 Encoding.
  24. $mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
  25. ]]></programlisting>
  26. <para>
  27. <classname>Zend_Mail_Transport_Smtp</classname> encodes lines starting with one dot or two dots so that the mail
  28. does not violate the SMTP protocol.
  29. </para>
  30. </sect1>
  31. <!--
  32. vim:se ts=4 sw=4 et:
  33. -->