Added feature #15998: Create a new API to send mails based on SwiftMailer to replace...
[Packages/TYPO3.CMS.git] / typo3 / contrib / swiftmailer / classes / Swift / MimePart.php
1 <?php
2
3 /*
4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 //@require 'Swift/Mime/MimePart.php';
12 //@require 'Swift/DependencyContainer.php';
13
14 /**
15 * A MIME part, in a multipart message.
16 * @package Swift
17 * @subpackage Mime
18 * @author Chris Corbyn
19 */
20 class Swift_MimePart extends Swift_Mime_MimePart
21 {
22
23 /**
24 * Create a new MimePart.
25 * Details may be optionally passed into the constructor.
26 * @param string $body
27 * @param string $contentType
28 * @param string $charset
29 */
30 public function __construct($body = null, $contentType = null,
31 $charset = null)
32 {
33 call_user_func_array(
34 array($this, 'Swift_Mime_MimePart::__construct'),
35 Swift_DependencyContainer::getInstance()
36 ->createDependenciesFor('mime.part')
37 );
38
39 if (!isset($charset))
40 {
41 $charset = Swift_DependencyContainer::getInstance()
42 ->lookup('properties.charset');
43 }
44 $this->setBody($body);
45 $this->setCharset($charset);
46 if ($contentType)
47 {
48 $this->setContentType($contentType);
49 }
50 }
51
52 /**
53 * Create a new MimePart.
54 * @param string $body
55 * @param string $contentType
56 * @param string $charset
57 * @return Swift_Mime_MimePart
58 */
59 public static function newInstance($body = null, $contentType = null,
60 $charset = null)
61 {
62 return new self($body, $contentType, $charset);
63 }
64
65 }