Path

ez components / documentation / api reference / 1.1.1 / mail


eZ Components 1.1.1

Mail: ezcMailPart

[ Tutorial ] [ Display-example ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcMailPart

Abstract base class for all mail MIME parts. [source]
This base class provides functionality to store headers and to generate the mail part. Implementations of this class must handle the body of that parts themselves. They must also implement generateBody() which is called when the message part is generated.

Descendents

Child Class Description
ezcMailRfc822Digest Mail part or mail digest parts.
ezcMailFile Mail part for all forms of binary data.
ezcMailText Mail part used for sending all forms of plain text.
ezcMailMultipart Abstract base class for all multipart types.
ezcMail The main mail class.

Properties

ezcMailContentDispositionHeader read/write  $contentDisposition
Contains the information from the Content-Disposition field of this mail. This useful especially when you are investigating retrieved mail to see if a part is an attachment or should be displayed inline. However, it can also be used to set the same on outgoing mail. Note that the ezcMailFile part sets the Content-Disposition field itself based on it's own properties when sending mail.

Method Summary

public ezcMailPart __construct( )
Constructs a new mail part.
public void appendExcludeHeaders( $headers )
The array $headers will be excluded when the headers are generated.
public string generate( )
Returns the complete mail part including both the header and the body as a string.
public abstract string generateBody( )
Returns the body of this part as a string.
public string generateHeaders( )
Returns the headers set for this part as a RFC 822 string.
public string getHeader( $name )
Returns the RAW value of the header $name.
public void setHeader( $name, $value )
Sets the header $name to the value $value.
public void setHeaders( $headers )
Adds the headers $headers.

Methods

__construct

ezcMailPart __construct( )
Constructs a new mail part.

Redefined in descendants as

Method Description
ezcMailRfc822Digest::__construct() Constructs a new ezcMailDigest with the mail $mail.
ezcMailFile::__construct() Constructs a new attachment with $fileName.
ezcMailText::__construct() Constructs a new TextPart with the given $text, $charset and $encoding.
ezcMailMultipart::__construct() Constructs a new ezcMailMultipart with the parts $parts.
ezcMailMultipartAlternative::__construct() Constructs a new ezcMailMultipartAlternative
ezcMailMultipartDigest::__construct() Constructs a new ezcMailMultipartDigest
ezcMailMultipartRelated::__construct() Constructs a new ezcMailMultipartRelated.
ezcMailMultipartMixed::__construct() Constructs a new ezcMailMultipartMixed
ezcMail::__construct() Constructs an empty ezcMail object.
ezcMailComposer::__construct() Constructs an empty ezcMailComposer object.

appendExcludeHeaders

void appendExcludeHeaders( $headers )
The array $headers will be excluded when the headers are generated.

Parameters

Name Type Description
$headers array(string)  

See also:

ezcMailPart::generateHeaders().


generate

string generate( )
Returns the complete mail part including both the header and the body as a string.

generateBody

string generateBody( )
Returns the body of this part as a string.
This method is called automatically by generate() and subclasses and must implement it.

Redefined in descendants as

Method Description
ezcMailRfc822Digest::generateBody() Returns the body part of this mail consisting of the digested mail.
ezcMailFile::generateBody() Returns the contents of the file with the correct encoding.
ezcMailText::generateBody() Returns the generated text body of this part as a string.
ezcMailMultipart::generateBody() Returns the generated body for all multipart types.
ezcMail::generateBody() Returns the generated body part of this mail.

generateHeaders

string generateHeaders( )
Returns the headers set for this part as a RFC 822 string.
Each header is separated by a line break. This method does not add the required two lines of space to separate the headers from the body of the part.
This function is called automatically by generate() and subclasses can override this method if they wish to set additional headers when the mail is generated.

See also:

ezcMailPart::setHeader().

Redefined in descendants as

Method Description
ezcMailText::generateHeaders() Returns the headers set for this part as a RFC822 compliant string.
ezcMail::generateHeaders() Returns the generated headers for the mail.

getHeader

string getHeader( string $name )
Returns the RAW value of the header $name.
Returns an empty string if the header is not found. Getting headers is case insensitive. Getting the header 'Message-Id' will match both 'Message-ID' and 'MESSAGE-ID' as well as 'Message-Id'.

Parameters

Name Type Description
$name string  

setHeader

void setHeader( string $name, string $value )
Sets the header $name to the value $value.
If the header is already set it will override the old value.
Note: The header Content-Disposition will be overwritten by the contents of the contentsDisposition property if set.

Parameters

Name Type Description
$name string  
$value string  

See also:

ezcMailPart::generateHeaders().


setHeaders

void setHeaders( $headers )
Adds the headers $headers.
The headers specified in the associative array of the form array(headername=>value) will overwrite any existing header values.

Parameters

Name Type Description
$headers array(string=>string)  

Last updated: Thu, 01 Nov 2007