The default email message class.

package Swift
subpackage Mime
author Chris Corbyn

 Methods

Create a new SimpleMessage with $headers, $encoder and $cache.

__construct(\Swift_Mime_HeaderSet $headers, \Swift_Mime_ContentEncoder $encoder, \Swift_KeyCache $cache, \Swift_Mime_Grammar $grammar, string $charset) 

Parameters

$charset

string

Empties it's own contents from the cache.

__destruct() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::__destruct()
inherited_from \Swift_Mime_MimePart::__destruct()

Returns a string representation of this object.

__toString() : string
see \toString()

Returns

string

Add a Bcc: address to this message.

addBcc(string $address, string $name) : \Swift_Mime_SimpleMessage

If $name is passed this name will be associated with the address.

Parameters

$address

string

$name

string

optional

Returns

Add a Cc: address to this message.

addCc(string $address, string $name) : \Swift_Mime_SimpleMessage

If $name is passed this name will be associated with the address.

Parameters

$address

string

$name

string

optional

Returns

Add a From: address to this message.

addFrom(string $address, string $name) 

If $name is passed this name will be associated with the address.

Parameters

$address

string

$name

string

optional

Add a Reply-To: address to this message.

addReplyTo(string $address, string $name) : \Swift_Mime_SimpleMessage

If $name is passed this name will be associated with the address.

Parameters

$address

string

$name

string

optional

Returns

Add a To: address to this message.

addTo(string $address, string $name) : \Swift_Mime_SimpleMessage

If $name is passed this name will be associated with the address.

Parameters

$address

string

$name

string

optional

Returns

Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart.

attach(\Swift_Mime_MimeEntity $entity) : \Swift_Mime_SimpleMessage

Receive notification that the charset has changed on this document, or a parent document.

charsetChanged(string $charset) 
Inherited
inherited_from \Swift_Mime_MimePart::charsetChanged()

Parameters

$charset

string

Remove an already attached entity.

detach(\Swift_Mime_MimeEntity $entity) : \Swift_Mime_SimpleMessage

Attach a {@link Swift_Mime_MimeEntity} and return it's CID source.

embed(\Swift_Mime_MimeEntity $entity) : string

This method should be used when embedding images or other data in a message.

Parameters

Returns

string

Receive notification that the encoder of this entity or a parent entity has changed.

encoderChanged(\Swift_Mime_ContentEncoder $encoder) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::encoderChanged()
inherited_from \Swift_Mime_MimePart::encoderChanged()

Parameters

Generates a valid Message-ID and switches to it.

generateId() : string
Inherited
inherited_from \Swift_Mime_Message::generateId()

Returns

string

Get the Bcc addresses of this message.

getBcc() : array

This method always returns an associative array, whereby the keys provide the actual email addresses.

Returns

array

Get the body of this entity as a string.

getBody() : string
Inherited

Returns NULL if no body has been set.

inherited_from \Swift_Mime_SimpleMimeEntity::getBody()
inherited_from \Swift_Mime_MimePart::getBody()

Returns

string

Get the boundary used to separate children in this entity.

getBoundary() : string
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getBoundary()
inherited_from \Swift_Mime_MimePart::getBoundary()

Returns

string

Get the Cc address of this message.

getCc() : array

This method always returns an associative array, whereby the keys provide the actual email addresses.

Returns

array

Get the character set of this entity.

getCharset() : string
Inherited
inherited_from \Swift_Mime_MimePart::getCharset()

Returns

string

Get all children added to this entity.

getChildren() : array
Inherited

These are not just the immediate children, but all children.

inherited_from \Swift_Mime_SimpleMimeEntity::getChildren()
inherited_from \Swift_Mime_MimePart::getChildren()

Returns

arrayof Swift_Mime_Entity

Get the Content-type of this entity.

getContentType() : string
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getContentType()
inherited_from \Swift_Mime_MimePart::getContentType()

Returns

string

Get the date at which this message was created.

getDate() : int

Returns

int

Test if delsp is being used for this entity.

getDelSp() : boolean
Inherited
inherited_from \Swift_Mime_MimePart::getDelSp()

Returns

boolean

Get the description of this entity.

getDescription() : string
Inherited

This value comes from the Content-Description header if set.

inherited_from \Swift_Mime_SimpleMimeEntity::getDescription()
inherited_from \Swift_Mime_MimePart::getDescription()

Returns

string

Get the encoder used for the body of this entity.

getEncoder() : \Swift_Mime_ContentEncoder
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getEncoder()
inherited_from \Swift_Mime_MimePart::getEncoder()

Returns

Get the format of this entity (i.e.

getFormat() : string
Inherited

flowed or fixed).

inherited_from \Swift_Mime_MimePart::getFormat()

Returns

string

Get the from address of this message.

getFrom() : string

This method always returns an associative array where the keys are the addresses.

Returns

string

Get the {@link Swift_Mime_HeaderSet} for this entity.

getHeaders() : \Swift_Mime_HeaderSet
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getHeaders()
inherited_from \Swift_Mime_MimePart::getHeaders()

Returns

Get the CID of this entity.

getId() : string
Inherited

The CID will only be present in headers if a Content-ID header is present.

inherited_from \Swift_Mime_SimpleMimeEntity::getId()
inherited_from \Swift_Mime_MimePart::getId()

Returns

string

Get the maximum line length of the body of this entity.

getMaxLineLength() : int
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getMaxLineLength()
inherited_from \Swift_Mime_MimePart::getMaxLineLength()

Returns

int

Always returns {@link LEVEL_TOP} for a message instance.

getNestingLevel() : int

The lower the value, the more outermost the entity will be nested.

Returns

int

Get the priority of this message.

getPriority() : int

The returned value is an integer where 1 is the highest priority and 5 is the lowest.

Returns

int

Get the addresses to which a read-receipt will be sent.

getReadReceiptTo() : string

Returns

string

Get the reply-to address of this message.

getReplyTo() : string

This method always returns an associative array where the keys provide the email addresses.

Returns

string

Get the return-path (bounce address) of this message.

getReturnPath() : string

Returns

string

Get the sender of this message.

getSender() : string

This has a higher significance than the From address.

Returns

string

Get the subject of this message.

getSubject() : string

Returns

string

Get the To addresses of this message.

getTo() : array

This method always returns an associative array, whereby the keys provide the actual email addresses.

Returns

array

Set the Bcc addresses of this message.

setBcc(array $addresses, string $name) : \Swift_Mime_SimpleMessage

If $name is passed and the first parameter is a string, this name will be associated with the address.

Parameters

$addresses

array

$name

string

optional

Returns

Set the body of this entity, either as a string, or as an instance of {@link Swift_OutputByteStream}.

setBody(mixed $body, string $contentType, string $charset) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_MimePart::setBody()

Parameters

$body

mixed

$contentType

string

optional

$charset

string

optional

Returns

Set the boundary used to separate children in this entity.

setBoundary(string $boundary) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::setBoundary()
inherited_from \Swift_Mime_MimePart::setBoundary()

Parameters

$boundary

string

Exceptions

\Swift_RfcComplianceException

Returns

Set the Cc addresses of this message.

setCc(array $addresses, string $name) : \Swift_Mime_SimpleMessage

If $name is passed and the first parameter is a string, this name will be associated with the address.

Parameters

$addresses

array

$name

string

optional

Returns

Set the character set of this entity.

setCharset(string $charset) 
Inherited
inherited_from \Swift_Mime_MimePart::setCharset()

Parameters

$charset

string

Set all children of this entity.

setChildren(array $children, int $compoundLevel) : \Swift_Mime_SimpleMimeEntity
Inherited

This includes grandchildren.

inherited_from \Swift_Mime_SimpleMimeEntity::setChildren()
inherited_from \Swift_Mime_MimePart::setChildren()

Parameters

$children

array

Swiift_Mime_Entity instances

$compoundLevel

int

For internal use only

Returns

Set the Content-type of this entity.

setContentType(string $type) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::setContentType()
inherited_from \Swift_Mime_MimePart::setContentType()

Parameters

$type

string

Returns

Set the date at which this message was created.

setDate(int $date) : \Swift_Mime_SimpleMessage

Parameters

$date

int

Returns

Turn delsp on or off for this entity.

setDelSp(boolean $delsp) 
Inherited
inherited_from \Swift_Mime_MimePart::setDelSp()

Parameters

$delsp

boolean

Set the description of this entity.

setDescription(string $description) : \Swift_Mime_SimpleMimeEntity
Inherited

This method sets a value in the Content-ID header.

inherited_from \Swift_Mime_SimpleMimeEntity::setDescription()
inherited_from \Swift_Mime_MimePart::setDescription()

Parameters

$description

string

Returns

Set the encoder used for the body of this entity.

setEncoder(\Swift_Mime_ContentEncoder $encoder) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::setEncoder()
inherited_from \Swift_Mime_MimePart::setEncoder()

Parameters

Returns

Set the format of this entity (flowed or fixed).

setFormat(string $format) 
Inherited
inherited_from \Swift_Mime_MimePart::setFormat()

Parameters

$format

string

Set the from address of this message.

setFrom(string $addresses, string $name) : \Swift_Mime_SimpleMessage

You may pass an array of addresses if this message is from multiple people.

If $name is passed and the first parameter is a string, this name will be associated with the address.

Parameters

$addresses

string

$name

string

optional

Returns

Set the CID of this entity.

setId(string $id) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::setId()
inherited_from \Swift_Mime_MimePart::setId()

Parameters

$id

string

Returns

Set the maximum line length of lines in this body.

setMaxLineLength(int $length) : \Swift_Mime_SimpleMimeEntity
Inherited

Though not enforced by the library, lines should not exceed 1000 chars.

inherited_from \Swift_Mime_SimpleMimeEntity::setMaxLineLength()
inherited_from \Swift_Mime_MimePart::setMaxLineLength()

Parameters

$length

int

Returns

Set the priority of this message.

setPriority(int $priority) : \Swift_Mime_SimpleMessage

The value is an integer where 1 is the highest priority and 5 is the lowest.

Parameters

$priority

int

Returns

Ask for a delivery receipt from the recipient to be sent to $addresses

setReadReceiptTo(array $addresses) : \Swift_Mime_SimpleMessage

Parameters

$addresses

array

Returns

Set the reply-to address of this message.

setReplyTo(string $addresses, string $name) : \Swift_Mime_SimpleMessage

You may pass an array of addresses if replies will go to multiple people.

If $name is passed and the first parameter is a string, this name will be associated with the address.

Parameters

$addresses

string

$name

string

optional

Returns

Set the return-path (the bounce address) of this message.

setReturnPath(string $address) : \Swift_Mime_SimpleMessage

Parameters

$address

string

Returns

Set the sender of this message.

setSender($address, string $name) : \Swift_Mime_SimpleMessage

This does not override the From field, but it has a higher significance.

Parameters

$address

$name

string

optional

Returns

Set the subject of this message.

setSubject(string $subject) : \Swift_Mime_SimpleMessage

Parameters

$subject

string

Returns

Set the to addresses of this message.

setTo(array $addresses, string $name) : \Swift_Mime_SimpleMessage

If multiple recipients will receive the message and array should be used.

If $name is passed and the first parameter is a string, this name will be associated with the address.

Parameters

$addresses

array

$name

string

optional

Returns

Write this message to a {@link Swift_InputByteStream}.

toByteStream(\Swift_InputByteStream $is) 

Parameters

Get this message as a complete string.

toString() : string

Returns

string

Empty the KeyCache for this entity.

_clearCache() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_clearCache()
inherited_from \Swift_Mime_MimePart::_clearCache()

Encode charset when charset is not utf-8

_convertString($string) 
Inherited
inherited_from \Swift_Mime_MimePart::_convertString()

Parameters

$string

Fix the content-type and encoding of this entity

_fixHeaders() 
Inherited
inherited_from \Swift_Mime_MimePart::_fixHeaders()

Get the KeyCache used in this entity.

_getCache() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getCache()
inherited_from \Swift_Mime_MimePart::_getCache()

Get the grammar used for validation.

_getGrammar() : \Swift_Mime_Grammar
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getGrammar()
inherited_from \Swift_Mime_MimePart::_getGrammar()

Returns

Get the model data (usually an array or a string) for $field.

_getHeaderFieldModel($field) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getHeaderFieldModel()
inherited_from \Swift_Mime_MimePart::_getHeaderFieldModel()

Parameters

$field

Get the parameter value of $parameter on $field header.

_getHeaderParameter($field, $parameter) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getHeaderParameter()
inherited_from \Swift_Mime_MimePart::_getHeaderParameter()

Parameters

$field

$parameter

Get the name of the header that provides the ID of this entity

_getIdField() 

Set the model data for $field.

_setHeaderFieldModel($field, $model) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setHeaderFieldModel()
inherited_from \Swift_Mime_MimePart::_setHeaderFieldModel()

Parameters

$field

$model

Set the parameter value of $parameter on $field header.

_setHeaderParameter($field, $parameter, $value) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setHeaderParameter()
inherited_from \Swift_Mime_MimePart::_setHeaderParameter()

Parameters

$field

$parameter

$value

Set the nesting level of this entity

_setNestingLevel($level) 
Inherited
inherited_from \Swift_Mime_MimePart::_setNestingLevel()

Parameters

$level

Returns a random Content-ID or Message-ID.

getRandomId() : string
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::getRandomId()
inherited_from \Swift_Mime_MimePart::getRandomId()

Returns

string

_assertValidBoundary()

_assertValidBoundary($boundary) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_assertValidBoundary()
inherited_from \Swift_Mime_MimePart::_assertValidBoundary()

Parameters

$boundary

Throws an Exception if the id passed does not comply with RFC 2822.

_assertValidId(string $id) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_assertValidId()
inherited_from \Swift_Mime_MimePart::_assertValidId()

Parameters

$id

string

Exceptions

\Swift_RfcComplianceException

Turn the body of this message into a child of itself if needed

_becomeMimePart() 

_childSortAlgorithm()

_childSortAlgorithm($a, $b) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_childSortAlgorithm()
inherited_from \Swift_Mime_MimePart::_childSortAlgorithm()

Parameters

$a

$b

_createChild()

_createChild() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_createChild()
inherited_from \Swift_Mime_MimePart::_createChild()

_getCompoundLevel()

_getCompoundLevel($children) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getCompoundLevel()
inherited_from \Swift_Mime_MimePart::_getCompoundLevel()

Parameters

$children

_getNeededChildLevel()

_getNeededChildLevel($child, $compoundLevel) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getNeededChildLevel()
inherited_from \Swift_Mime_MimePart::_getNeededChildLevel()

Parameters

$child

$compoundLevel

Get the highest nesting level nested inside this message

_getTopNestingLevel() 

_notifyCharsetChanged()

_notifyCharsetChanged($charset) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_notifyCharsetChanged()
inherited_from \Swift_Mime_MimePart::_notifyCharsetChanged()

Parameters

$charset

_notifyEncoderChanged()

_notifyEncoderChanged(\Swift_Mime_ContentEncoder $encoder) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_notifyEncoderChanged()
inherited_from \Swift_Mime_MimePart::_notifyEncoderChanged()

Parameters

$encoder

_readStream()

_readStream(\Swift_OutputByteStream $os) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_readStream()
inherited_from \Swift_Mime_MimePart::_readStream()

Parameters

$os

_setContentTypeInHeaders()

_setContentTypeInHeaders($type) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setContentTypeInHeaders()
inherited_from \Swift_Mime_MimePart::_setContentTypeInHeaders()

Parameters

$type

_setEncoding()

_setEncoding($encoding) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setEncoding()
inherited_from \Swift_Mime_MimePart::_setEncoding()

Parameters

$encoding

_sortChildren()

_sortChildren() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_sortChildren()
inherited_from \Swift_Mime_MimePart::_sortChildren()

 Properties

 

$_userCharset 
Inherited
inherited_from \Swift_Mime_MimePart::$$_userCharset
 

$_userContentType 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_userContentType
inherited_from \Swift_Mime_MimePart::$$_userContentType
 

$_userDelSp 
Inherited
inherited_from \Swift_Mime_MimePart::$$_userDelSp
 

$_userFormat 
Inherited
inherited_from \Swift_Mime_MimePart::$$_userFormat
 

$_alternativePartOrder 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_alternativePartOrder
inherited_from \Swift_Mime_MimePart::$$_alternativePartOrder
 

$_body 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_body
inherited_from \Swift_Mime_MimePart::$$_body
 

$_boundary 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_boundary
inherited_from \Swift_Mime_MimePart::$$_boundary
 

$_cache 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_cache
inherited_from \Swift_Mime_MimePart::$$_cache
 

$_cacheKey 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_cacheKey
inherited_from \Swift_Mime_MimePart::$$_cacheKey
 

$_children 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_children
inherited_from \Swift_Mime_MimePart::$$_children
 

$_compositeRanges 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_compositeRanges
inherited_from \Swift_Mime_MimePart::$$_compositeRanges
 

$_compoundLevelFilters 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_compoundLevelFilters
inherited_from \Swift_Mime_MimePart::$$_compoundLevelFilters
 

$_encoder 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_encoder
inherited_from \Swift_Mime_MimePart::$$_encoder
 

$_grammar 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_grammar
inherited_from \Swift_Mime_MimePart::$$_grammar
 

$_headers 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_headers
inherited_from \Swift_Mime_MimePart::$$_headers
 

$_id 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_id
inherited_from \Swift_Mime_MimePart::$$_id
 

$_immediateChildren 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_immediateChildren
inherited_from \Swift_Mime_MimePart::$$_immediateChildren
 

$_maxLineLength 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_maxLineLength
inherited_from \Swift_Mime_MimePart::$$_maxLineLength
 

$_nestingLevel 
Inherited
inherited_from \Swift_Mime_MimePart::$$_nestingLevel

 Constants

 

An entity which nests with the same precedence as a mime part

LEVEL_ALTERNATIVE 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE
inherited_from \Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE
inherited_from \Swift_Mime_MimePart::LEVEL_ALTERNATIVE
 

An entity which nests with the same precedence as an attachment

LEVEL_MIXED 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_MIXED
inherited_from \Swift_Mime_SimpleMimeEntity::LEVEL_MIXED
inherited_from \Swift_Mime_MimePart::LEVEL_MIXED
   

Main message document; there can only be one of these

LEVEL_TOP 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_TOP
inherited_from \Swift_Mime_SimpleMimeEntity::LEVEL_TOP
inherited_from \Swift_Mime_MimePart::LEVEL_TOP