XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
Message.php
Go to the documentation of this file.
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/SimpleMessage.php';
12 //@require 'Swift/MimePart.php';
13 //@require 'Swift/DependencyContainer.php';
14 
22 {
23 
32  public function __construct($subject = null, $body = null,
33  $contentType = null, $charset = null)
34  {
35  call_user_func_array(
36  array($this, 'Swift_Mime_SimpleMessage::__construct'),
38  ->createDependenciesFor('mime.message')
39  );
40 
41  if (!isset($charset))
42  {
44  ->lookup('properties.charset');
45  }
46  $this->setSubject($subject);
47  $this->setBody($body);
48  $this->setCharset($charset);
49  if ($contentType)
50  {
51  $this->setContentType($contentType);
52  }
53  }
54 
63  public static function newInstance($subject = null, $body = null,
64  $contentType = null, $charset = null)
65  {
66  return new self($subject, $body, $contentType, $charset);
67  }
68 
75  public function addPart($body, $contentType = null, $charset = null)
76  {
77  return $this->attach(Swift_MimePart::newInstance(
78  $body, $contentType, $charset
79  ));
80  }
81 
82 }