Zend_Mail-Encoding.xml 1.9 KB

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