Zend Framework  3.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Message Class Reference

Public Member Functions

 isValid ()
 Is the message valid?
 
 setEncoding ($encoding)
 Set the message encoding.
 
 getEncoding ()
 Get the message encoding.
 
 setHeaders (Headers $headers)
 Compose headers.
 
 getHeaders ()
 Access headers collection.
 
 setFrom ($emailOrAddressList, $name=null)
 Set (overwrite) From addresses.
 
 addFrom ($emailOrAddressOrList, $name=null)
 Add a "From" address.
 
 getFrom ()
 Retrieve list of From senders.
 
 setTo ($emailOrAddressList, $name=null)
 Overwrite the address list in the To recipients.
 
 addTo ($emailOrAddressOrList, $name=null)
 Add one or more addresses to the To recipients.
 
 getTo ()
 Access the address list of the To header.
 
 setCc ($emailOrAddressList, $name=null)
 Set (overwrite) CC addresses.
 
 addCc ($emailOrAddressOrList, $name=null)
 Add a "Cc" address.
 
 getCc ()
 Retrieve list of CC recipients.
 
 setBcc ($emailOrAddressList, $name=null)
 Set (overwrite) BCC addresses.
 
 addBcc ($emailOrAddressOrList, $name=null)
 Add a "Bcc" address.
 
 getBcc ()
 Retrieve list of BCC recipients.
 
 setReplyTo ($emailOrAddressList, $name=null)
 Overwrite the address list in the Reply-To recipients.
 
 addReplyTo ($emailOrAddressOrList, $name=null)
 Add one or more addresses to the Reply-To recipients.
 
 getReplyTo ()
 Access the address list of the Reply-To header.
 
 setSender ($emailOrAddress, $name=null)
 setSender
 
 getSender ()
 Retrieve the sender address, if any.
 
 setSubject ($subject)
 Set the message subject header value.
 
 getSubject ()
 Get the message subject header value.
 
 setBody ($body)
 Set the message body.
 
 getBody ()
 Return the currently set message body.
 
 getBodyText ()
 Get the string-serialized message body text.
 
 toString ()
 Serialize to string.
 

Static Public Member Functions

static fromString ($rawMessage)
 Instantiate from raw message string.
 

Protected Member Functions

 getHeaderByName ($headerName, $headerClass)
 Retrieve a header by name.
 
 clearHeaderByName ($headerName)
 Clear a header by name.
 
 getAddressListFromHeader ($headerName, $headerClass)
 Retrieve the AddressList from a named header.
 
 updateAddressList (AddressList $addressList, $emailOrAddressOrList, $name, $callingMethod)
 Update an address list.
 

Protected Attributes

 $body
 
 $headers
 
 $encoding = 'ASCII'
 

Member Function Documentation

addBcc (   $emailOrAddressOrList,
  $name = null 
)

Add a "Bcc" address.

Parameters
string | Address | array | AddressList | Traversable$emailOrAddressOrList
string | null$name
Returns
Message
addCc (   $emailOrAddressOrList,
  $name = null 
)

Add a "Cc" address.

Parameters
string | Address | array | AddressList | Traversable$emailOrAddressOrList
string | null$name
Returns
Message
addFrom (   $emailOrAddressOrList,
  $name = null 
)

Add a "From" address.

Parameters
string | Address | array | AddressList | Traversable$emailOrAddressOrList
string | null$name
Returns
Message
addReplyTo (   $emailOrAddressOrList,
  $name = null 
)

Add one or more addresses to the Reply-To recipients.

Appends to the list.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressOrList
null | string$name
Returns
Message
addTo (   $emailOrAddressOrList,
  $name = null 
)

Add one or more addresses to the To recipients.

Appends to the list.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressOrList
null | string$name
Returns
Message
clearHeaderByName (   $headerName)
protected

Clear a header by name.

Parameters
string$headerName
static fromString (   $rawMessage)
static

Instantiate from raw message string.

Todo:
Restore body to Mime
Parameters
string$rawMessage
Returns
Message
getAddressListFromHeader (   $headerName,
  $headerClass 
)
protected

Retrieve the AddressList from a named header.

Used with To, From, Cc, Bcc, and ReplyTo headers. If the header does not exist, instantiates it.

Parameters
string$headerName
string$headerClass
Exceptions
Exception\DomainException
Returns
AddressList
getBcc ( )

Retrieve list of BCC recipients.

Returns
AddressList
getBody ( )

Return the currently set message body.

Returns
object
getBodyText ( )

Get the string-serialized message body text.

Returns
string
getCc ( )

Retrieve list of CC recipients.

Returns
AddressList
getEncoding ( )

Get the message encoding.

Returns
string
getFrom ( )

Retrieve list of From senders.

Returns
AddressList
getHeaderByName (   $headerName,
  $headerClass 
)
protected

Retrieve a header by name.

If not found, instantiates one based on $headerClass.

Parameters
string$headerName
string$headerClass
Returns
Header| header instance or collection of headers
getHeaders ( )

Access headers collection.

Lazy-loads if not already attached.

Returns
Headers
getReplyTo ( )

Access the address list of the Reply-To header.

Returns
AddressList
getSender ( )

Retrieve the sender address, if any.

Returns
null|Address
getSubject ( )

Get the message subject header value.

Returns
null|string
getTo ( )

Access the address list of the To header.

Returns
AddressList
isValid ( )

Is the message valid?

If we don't any From addresses, we're invalid, according to RFC2822.

Returns
bool
setBcc (   $emailOrAddressList,
  $name = null 
)

Set (overwrite) BCC addresses.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressList
string | null$name
Returns
Message
setBody (   $body)

Set the message body.

Parameters
null | string | \Zend\Mime\Message | object$body
Exceptions
Exception\InvalidArgumentException
Returns
Message
setCc (   $emailOrAddressList,
  $name = null 
)

Set (overwrite) CC addresses.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressList
string | null$name
Returns
Message
setEncoding (   $encoding)

Set the message encoding.

Parameters
string$encoding
Returns
Message
setFrom (   $emailOrAddressList,
  $name = null 
)

Set (overwrite) From addresses.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressList
string | null$name
Returns
Message
setHeaders ( Headers  $headers)

Compose headers.

Parameters
Headers$headers
Returns
Message
setReplyTo (   $emailOrAddressList,
  $name = null 
)

Overwrite the address list in the Reply-To recipients.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressList
null | string$name
Returns
Message
setSender (   $emailOrAddress,
  $name = null 
)

setSender

Parameters
mixed$emailOrAddress
mixed$name
Returns
Message
setSubject (   $subject)

Set the message subject header value.

Parameters
string$subject
Returns
Message
setTo (   $emailOrAddressList,
  $name = null 
)

Overwrite the address list in the To recipients.

Parameters
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressList
null | string$name
Returns
Message
toString ( )

Serialize to string.

Returns
string
updateAddressList ( AddressList  $addressList,
  $emailOrAddressOrList,
  $name,
  $callingMethod 
)
protected

Update an address list.

Proxied to this from addFrom, addTo, addCc, addBcc, and addReplyTo.

Parameters
AddressList$addressList
string | Address\AddressInterface | array | AddressList | Traversable$emailOrAddressOrList
null | string$name
string$callingMethod
Exceptions
Exception\InvalidArgumentException

Member Data Documentation

$body
protected
$encoding = 'ASCII'
protected
$headers
protected