Hoa central
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
Hoa\Mail\Message Class Reference
Inheritance diagram for Hoa\Mail\Message:

Public Member Functions

 __construct ()
 
 setTransport (Transport\ITransport\Out $transport)
 
 getTransport ()
 
 send ()
 
- Public Member Functions inherited from Hoa\Mail\Content\Message
 __construct ()
 
 addContent (Content $content)
 
 getContent ()
 
 getRecipients ()
 
 getFormattedContent ($headers=false)
 
- Public Member Functions inherited from Hoa\Mail\Content\Content
 __construct ()
 
 offsetExists ($header)
 
 offsetGet ($header)
 
 offsetSet ($header, $value)
 
 offsetUnset ($header)
 
 getHeaders ()
 
 getFormattedContent ($headers=true)
 
 getId ()
 
 getIdUrl ()
 
 __toString ()
 

Static Public Member Functions

static setDefaultTransport (Transport\ITransport\Out $transport)
 
static getDefaultTransport ()
 
- Static Public Member Functions inherited from Hoa\Mail\Content\Content
static formatHeaders (Array $headers)
 
static getAddress ($contact)
 
static getDomain ($contact)
 

Public Attributes

const MIME_VERSION = '1.0'
 
- Public Attributes inherited from Hoa\Mail\Content\Message
const BOUNDARY = '@hoaproject-'
 

Protected Attributes

 $_transport = null
 
- Protected Attributes inherited from Hoa\Mail\Content\Message
 $_content = []
 
- Protected Attributes inherited from Hoa\Mail\Content\Content
 $_headers = []
 

Static Protected Attributes

static $_defaultTransport = null
 

Additional Inherited Members

- Protected Member Functions inherited from Hoa\Mail\Content\Message
 _getContent ()
 
 _getRecipients ($line, Array &$out)
 
- Protected Member Functions inherited from Hoa\Mail\Content\Content
 _getContent ()
 

Detailed Description

Class .

This class represents a message that can be sent through a transport.

Definition at line 47 of file Message.php.

Constructor & Destructor Documentation

Hoa\Mail\Message::__construct ( )

Construct a message.

Returns
void

Definition at line 78 of file Message.php.

79  {
80  parent::__construct();
81  $this['mime-version'] = static::MIME_VERSION;
82 
83  return;
84  }

Member Function Documentation

static Hoa\Mail\Message::getDefaultTransport ( )
static

Get default transport layer.

Returns

Definition at line 105 of file Message.php.

106  {
107  return static::$_defaultTransport;
108  }
Hoa\Mail\Message::getTransport ( )

Get a transport layer (the current or default one).

Returns

Definition at line 129 of file Message.php.

130  {
131  return $this->_transport ?: static::getDefaultTransport();
132  }

Here is the caller graph for this function:

Hoa\Mail\Message::send ( )

Send the message.

Returns
bool
Exceptions

Definition at line 140 of file Message.php.

141  {
142  $transport = $this->getTransport();
143 
144  if (null === $transport) {
145  throw new Exception(
146  'Cannot send a message without specifying a transport.',
147  0
148  );
149  }
150 
151  return $transport->send($this);
152  }

Here is the call graph for this function:

static Hoa\Mail\Message::setDefaultTransport ( Transport\ITransport\Out  $transport)
static

Set default transport layer.

Parameters
\Hoa\Mail\Transport\ITransport\Out$transportTransport.
Returns

Definition at line 92 of file Message.php.

93  {
94  $old = static::$_defaultTransport;
95  static::$_defaultTransport = $transport;
96 
97  return $old;
98  }
Hoa\Mail\Message::setTransport ( Transport\ITransport\Out  $transport)

Set transport layer.

Parameters
\Hoa\Mail\Transport\ITransport\Out$transportTransport.
Returns

Definition at line 116 of file Message.php.

117  {
118  $old = $this->_transport;
119  $this->_transport = $transport;
120 
121  return $old;
122  }

Member Data Documentation

Hoa\Mail\Message::$_defaultTransport = null
staticprotected

Definition at line 61 of file Message.php.

Hoa\Mail\Message::$_transport = null
protected

Definition at line 68 of file Message.php.

const Hoa\Mail\Message::MIME_VERSION = '1.0'

MIME version.

string

Definition at line 54 of file Message.php.


The documentation for this class was generated from the following file: