|
TYPO3 API
SVNRelease
|
00001 <?php 00002 00003 /* 00004 * This file is part of SwiftMailer. 00005 * (c) 2004-2009 Chris Corbyn 00006 * 00007 * For the full copyright and license information, please view the LICENSE 00008 * file that was distributed with this source code. 00009 */ 00010 00011 //@require 'Swift/Mime/SimpleMessage.php'; 00012 //@require 'Swift/MimePart.php'; 00013 //@require 'Swift/DependencyContainer.php'; 00014 00015 /** 00016 * The Message class for building emails. 00017 * @package Swift 00018 * @subpackage Mime 00019 * @author Chris Corbyn 00020 */ 00021 class Swift_Message extends Swift_Mime_SimpleMessage 00022 { 00023 00024 /** 00025 * Create a new Message. 00026 * Details may be optionally passed into the constructor. 00027 * @param string $subject 00028 * @param string $body 00029 * @param string $contentType 00030 * @param string $charset 00031 */ 00032 public function __construct($subject = null, $body = null, 00033 $contentType = null, $charset = null) 00034 { 00035 call_user_func_array( 00036 array($this, 'Swift_Mime_SimpleMessage::__construct'), 00037 Swift_DependencyContainer::getInstance() 00038 ->createDependenciesFor('mime.message') 00039 ); 00040 00041 if (!isset($charset)) 00042 { 00043 $charset = Swift_DependencyContainer::getInstance() 00044 ->lookup('properties.charset'); 00045 } 00046 $this->setSubject($subject); 00047 $this->setBody($body); 00048 $this->setCharset($charset); 00049 if ($contentType) 00050 { 00051 $this->setContentType($contentType); 00052 } 00053 } 00054 00055 /** 00056 * Create a new Message. 00057 * @param string $subject 00058 * @param string $body 00059 * @param string $contentType 00060 * @param string $charset 00061 * @return Swift_Mime_Message 00062 */ 00063 public static function newInstance($subject = null, $body = null, 00064 $contentType = null, $charset = null) 00065 { 00066 return new self($subject, $body, $contentType, $charset); 00067 } 00068 00069 /** 00070 * Add a MimePart to this Message. 00071 * @param string|Swift_OutputByteStream $body 00072 * @param string $contentType 00073 * @param string $charset 00074 */ 00075 public function addPart($body, $contentType = null, $charset = null) 00076 { 00077 return $this->attach(Swift_MimePart::newInstance( 00078 $body, $contentType, $charset 00079 )); 00080 } 00081 00082 }
1.8.0