An embedded file, in a multipart message.

package Swift
subpackage Mime
author Chris Corbyn

 Methods

Creates a new Attachment with $headers and $encoder.

__construct(\Swift_Mime_HeaderSet $headers, \Swift_Mime_ContentEncoder $encoder, \Swift_KeyCache $cache, \Swift_Mime_Grammar $grammar, array $mimeTypes) 

Parameters

$mimeTypes

array

optional

Empties it's own contents from the cache.

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

Returns a string representation of this object.

__toString() : string
Inherited
see \toString()
inherited_from \Swift_Mime_SimpleMimeEntity::__toString()
inherited_from \Swift_Mime_Attachment::__toString()

Returns

string

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

charsetChanged(string $charset) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::charsetChanged()
inherited_from \Swift_Mime_Attachment::charsetChanged()

Parameters

$charset

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_Attachment::encoderChanged()

Parameters

Generate a new Content-ID or Message-ID for this MIME entity.

generateId() : string
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::generateId()
inherited_from \Swift_Mime_Attachment::generateId()

Returns

string

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_Attachment::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_Attachment::getBoundary()

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_Attachment::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_Attachment::getContentType()

Returns

string

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_Attachment::getDescription()

Returns

string

Get the Content-Disposition of this attachment.

getDisposition() : string
Inherited

By default attachments have a disposition of "attachment".

inherited_from \Swift_Mime_Attachment::getDisposition()

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_Attachment::getEncoder()

Returns

Get the filename of this attachment when downloaded.

getFilename() : string
Inherited
inherited_from \Swift_Mime_Attachment::getFilename()

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_Attachment::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_Attachment::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_Attachment::getMaxLineLength()

Returns

int

Get the nesting level of this EmbeddedFile.

getNestingLevel() : int

Returns LEVEL_RELATED.

Returns

int

Get the file size of this attachment.

getSize() : int
Inherited
inherited_from \Swift_Mime_Attachment::getSize()

Returns

int

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

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

Parameters

$body

mixed

$contentType

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_Attachment::setBoundary()

Parameters

$boundary

string

Exceptions

\Swift_RfcComplianceException

Returns

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_Attachment::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_Attachment::setContentType()

Parameters

$type

string

Returns

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_Attachment::setDescription()

Parameters

$description

string

Returns

Set the Content-Disposition of this attachment.

setDisposition(string $disposition) : \Swift_Mime_Attachment
Inherited
inherited_from \Swift_Mime_Attachment::setDisposition()

Parameters

$disposition

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_Attachment::setEncoder()

Parameters

Returns

Set the file that this attachment is for.

setFile(\Swift_FileStream $file, string $contentType) : \Swift_Mime_Attachment
Inherited
inherited_from \Swift_Mime_Attachment::setFile()

Parameters

$contentType

string

optional

Returns

Set the filename of this attachment.

setFilename(string $filename) : \Swift_Mime_Attachment
Inherited
inherited_from \Swift_Mime_Attachment::setFilename()

Parameters

$filename

string

Returns

Set the CID of this entity.

setId(string $id) : \Swift_Mime_SimpleMimeEntity
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::setId()
inherited_from \Swift_Mime_Attachment::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_Attachment::setMaxLineLength()

Parameters

$length

int

Returns

Set the file size of this attachment.

setSize(int $size) : \Swift_Mime_Attachment
Inherited
inherited_from \Swift_Mime_Attachment::setSize()

Parameters

$size

int

Returns

Write this entire entity to a {@link Swift_InputByteStream}.

toByteStream(\Swift_InputByteStream $is) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::toByteStream()
inherited_from \Swift_Mime_Attachment::toByteStream()

Parameters

Get this entire entity as a string.

toString() : string
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::toString()
inherited_from \Swift_Mime_Attachment::toString()

Returns

string

Empty the KeyCache for this entity.

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

Re-evaluate what content type and encoding should be used on this entity.

_fixHeaders() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_fixHeaders()
inherited_from \Swift_Mime_Attachment::_fixHeaders()

Get the KeyCache used in this entity.

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

Get the grammar used for validation.

_getGrammar() : \Swift_Mime_Grammar
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getGrammar()
inherited_from \Swift_Mime_Attachment::_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_Attachment::_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_Attachment::_getHeaderParameter()

Parameters

$field

$parameter

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

_getIdField() 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_getIdField()
inherited_from \Swift_Mime_Attachment::_getIdField()

Set the model data for $field.

_setHeaderFieldModel($field, $model) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setHeaderFieldModel()
inherited_from \Swift_Mime_Attachment::_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_Attachment::_setHeaderParameter()

Parameters

$field

$parameter

$value

Returns a random Content-ID or Message-ID.

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

Returns

string

_assertValidBoundary()

_assertValidBoundary($boundary) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_assertValidBoundary()
inherited_from \Swift_Mime_Attachment::_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_Attachment::_assertValidId()

Parameters

$id

string

Exceptions

\Swift_RfcComplianceException

_childSortAlgorithm()

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

Parameters

$a

$b

_createChild()

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

_getCompoundLevel()

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

Parameters

$children

_getNeededChildLevel()

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

Parameters

$child

$compoundLevel

_notifyCharsetChanged()

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

Parameters

$charset

_notifyEncoderChanged()

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

Parameters

$encoder

_readStream()

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

Parameters

$os

_setContentTypeInHeaders()

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

Parameters

$type

_setEncoding()

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

Parameters

$encoding

_setNestingLevel()

_setNestingLevel($level) 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::_setNestingLevel()
inherited_from \Swift_Mime_Attachment::_setNestingLevel()

Parameters

$level

_sortChildren()

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

 Properties

 

$_userContentType 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_userContentType
inherited_from \Swift_Mime_Attachment::$$_userContentType
 

$_alternativePartOrder 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_alternativePartOrder
inherited_from \Swift_Mime_Attachment::$$_alternativePartOrder
 

$_body 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_body
inherited_from \Swift_Mime_Attachment::$$_body
 

$_boundary 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_boundary
inherited_from \Swift_Mime_Attachment::$$_boundary
 

$_cache 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_cache
inherited_from \Swift_Mime_Attachment::$$_cache
 

$_cacheKey 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_cacheKey
inherited_from \Swift_Mime_Attachment::$$_cacheKey
 

$_children 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_children
inherited_from \Swift_Mime_Attachment::$$_children
 

$_compositeRanges 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_compositeRanges
inherited_from \Swift_Mime_Attachment::$$_compositeRanges
 

$_compoundLevelFilters 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_compoundLevelFilters
inherited_from \Swift_Mime_Attachment::$$_compoundLevelFilters
 

$_encoder 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_encoder
inherited_from \Swift_Mime_Attachment::$$_encoder
 

$_grammar 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_grammar
inherited_from \Swift_Mime_Attachment::$$_grammar
 

$_headers 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_headers
inherited_from \Swift_Mime_Attachment::$$_headers
 

$_id 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_id
inherited_from \Swift_Mime_Attachment::$$_id
 

$_immediateChildren 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_immediateChildren
inherited_from \Swift_Mime_Attachment::$$_immediateChildren
 

$_maxLineLength 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_maxLineLength
inherited_from \Swift_Mime_Attachment::$$_maxLineLength
 

$_mimeTypes 
Inherited
inherited_from \Swift_Mime_Attachment::$$_mimeTypes
 

$_nestingLevel 
Inherited
inherited_from \Swift_Mime_SimpleMimeEntity::$$_nestingLevel
inherited_from \Swift_Mime_Attachment::$$_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_Attachment::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_Attachment::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_Attachment::LEVEL_TOP