preferences.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /****************************************************************************/
  3. /* */
  4. /* YOU MAY WISH TO MODIFY OR REMOVE THE FOLLOWING LINES WHICH SET DEFAULTS */
  5. /* */
  6. /****************************************************************************/
  7. $preferences = Swift_Preferences::getInstance();
  8. // Sets the default charset so that setCharset() is not needed elsewhere
  9. $preferences->setCharset('utf-8');
  10. // Without these lines the default caching mechanism is "array" but this uses a lot of memory.
  11. // If possible, use a disk cache to enable attaching large attachments etc.
  12. // You can override the default temporary directory by setting the TMPDIR environment variable.
  13. // The @ operator in front of is_writable calls is to avoid PHP warnings
  14. // when using open_basedir
  15. $tmp = getenv('TMPDIR');
  16. if ($tmp && @is_writable($tmp)) {
  17. $preferences
  18. ->setTempDir($tmp)
  19. ->setCacheType('disk');
  20. } elseif (function_exists('sys_get_temp_dir') && @is_writable(sys_get_temp_dir())) {
  21. $preferences
  22. ->setTempDir(sys_get_temp_dir())
  23. ->setCacheType('disk');
  24. }
  25. // this should only be done when Swiftmailer won't use the native QP content encoder
  26. // see mime_deps.php
  27. if (version_compare(phpversion(), '5.4.7', '<')) {
  28. $preferences->setQPDotEscape(false);
  29. }