RawContentEncoder.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Handles raw Transfer Encoding in Swift Mailer.
  11. *
  12. * When sending 8-bit content over SMTP, you should use
  13. * Swift_Transport_Esmtp_EightBitMimeHandler to enable the 8BITMIME SMTP
  14. * extension.
  15. *
  16. * @author Sebastiaan Stok <s.stok@rollerscapes.net>
  17. */
  18. class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder
  19. {
  20. /**
  21. * Encode a given string to produce an encoded string.
  22. *
  23. * @param string $string
  24. * @param int $firstLineOffset ignored
  25. * @param int $maxLineLength ignored
  26. *
  27. * @return string
  28. */
  29. public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
  30. {
  31. return $string;
  32. }
  33. /**
  34. * Encode stream $in to stream $out.
  35. *
  36. * @param int $firstLineOffset ignored
  37. * @param int $maxLineLength ignored
  38. */
  39. public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
  40. {
  41. while (false !== ($bytes = $os->read(8192))) {
  42. $is->write($bytes);
  43. }
  44. }
  45. /**
  46. * Get the name of this encoding scheme.
  47. *
  48. * @return string
  49. */
  50. public function getName()
  51. {
  52. return 'raw';
  53. }
  54. /**
  55. * Not used.
  56. */
  57. public function charsetChanged($charset)
  58. {
  59. }
  60. }