MimePart.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. * A MIME part, in a multipart message.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. class Swift_MimePart extends Swift_Mime_MimePart
  15. {
  16. /**
  17. * Create a new MimePart.
  18. *
  19. * Details may be optionally passed into the constructor.
  20. *
  21. * @param string $body
  22. * @param string $contentType
  23. * @param string $charset
  24. */
  25. public function __construct($body = null, $contentType = null, $charset = null)
  26. {
  27. \call_user_func_array(
  28. [$this, 'Swift_Mime_MimePart::__construct'],
  29. Swift_DependencyContainer::getInstance()
  30. ->createDependenciesFor('mime.part')
  31. );
  32. if (!isset($charset)) {
  33. $charset = Swift_DependencyContainer::getInstance()
  34. ->lookup('properties.charset');
  35. }
  36. $this->setBody($body);
  37. $this->setCharset($charset);
  38. if ($contentType) {
  39. $this->setContentType($contentType);
  40. }
  41. }
  42. }