Zend_Mail-Encoding.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <acronym>HTML</acronym> message bodies are encoded with the quotedprintable
  7. mechanism by default. Message headers are also encoded with the quotedprintable mechanism if
  8. you do not specify base64 in <methodname>setHeaderEncoding()</methodname>. If you use
  9. language that is not Roman letters-based, the base64 would be more suitable. All other
  10. attachments are encoded via base64 if no other encoding is given in the
  11. <methodname>addAttachment()</methodname> call or assigned to the <acronym>MIME</acronym>
  12. part object later. 7Bit and 8Bit encoding currently only pass on the binary content data.
  13. </para>
  14. <para>
  15. Header Encoding, especially the encoding of the subject, is a tricky topic.
  16. <classname>Zend_Mime</classname> currently implements its own algorithm to encode quoted
  17. printable headers according to RFC-2045. This due to the problems of
  18. <methodname>iconv_mime_encode()</methodname> and
  19. <methodname>mb_encode_mimeheader()</methodname> with regards to certain
  20. charsets. This algorithm only breaks the header at spaces, which might lead to headers that
  21. far exceed the suggested length of 76 chars. For this cases it is suggested to switch to
  22. BASE64 header encoding same as the following example describes:
  23. </para>
  24. <programlisting language="php"><![CDATA[
  25. // By default Zend_Mime::ENCODING_QUOTEDPRINTABLE
  26. $mail = new Zend_Mail('KOI8-R');
  27. // Reset to Base64 Encoding because Russian expressed in KOI8-R is
  28. // different from Roman letters-based languages greatly.
  29. $mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
  30. ]]></programlisting>
  31. <para>
  32. <classname>Zend_Mail_Transport_Smtp</classname> encodes lines starting with one dot or two
  33. dots so that the mail does not violate the SMTP protocol.
  34. </para>
  35. </sect1>
  36. <!--
  37. vim:se ts=4 sw=4 et:
  38. -->