Mail: ezcMailMultipartRelated
[ ]
[ Display example ] [ Mail listing example ] [ Rfcs ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMailMultipartRelated
|
ezcMailMultipartRelated is intended for mail parts consisting of several inter-related body parts. [
source]
A typical example is an HTML mail with embedded images. When you want to refer to a related part you can use content id's (cid). Set the 'Content-ID' header of the related part to a valid unique url-addr-spec (specified by RFC 822) and refer to it through the form cid:unique-string.
Example: This example shows how you can use ezcMailMultipartRelated to create an HTML mail with an inline image.
1. $mail = new ezcMail();
2. $mail->from = new ezcMailAddress( 'sender@example.com', 'Adrian Ripburger' );
3. $mail->addTo( new ezcMailAddress( 'receiver@example.com', 'Maureen Corley' ) );
4. $mail->subject = "Example of an HTML email with attachments";
5. $htmlText = new ezcMailText( "<html>Image <img src='cid:image@12345' /></html>" );
6. $htmlText->subType = 'html';
7. $image = new ezcMailFile( "path_to_my_image.jpg" );
8. $image->contentId = 'image@12345';
9. $mail->body = new ezcMailMultipartRelated( $htmlText, $image );
Parents
ezcMailPart
|
--ezcMailMultipart
|
--ezcMailMultipartRelated
Inherited Constants
From
ezcMailMultipart:
Inherited Member Variables
From
ezcMailMultipart:
From
ezcMailPart:
Method Summary
|
public ezcMailMultipartRelated |
__construct(
$... )
Constructs a new ezcMailMultipartRelated. |
|
public string |
addRelatedPart(
$part )
Adds $part to the list of parts and returns the Content-ID of the part. |
|
public array(ezcMailPart) |
getMainPart(
)
Returns the main part of this multipart or null if there is no such part. |
|
public ezcMailPart |
getRelatedPartByID(
$cid )
Returns the part associated with the passed Content-ID. |
|
public array(ezcMailPart) |
getRelatedParts(
)
Returns the mail parts associated with this multipart. |
|
public string |
multipartType(
)
Returns "related". |
|
public void |
setMainPart(
$part )
Sets the main part $part of this alternative multipart. |
Inherited Methods
From
ezcMailMultipart :
From
ezcMailPart :
Methods
__construct
ezcMailMultipartRelated __construct(
ezcMailPart|array(ezcMailPart)
$... )
Constructs a new ezcMailMultipartRelated.
The constructor accepts an arbitrary number of ezcMailParts or arrays with ezcMailparts. Parts are added in the order provided and the first part will be recognized as the main body. Parameters of the wrong type are ignored.
Parameters
| Name |
Type |
Description |
$... |
ezcMailPart|array(ezcMailPart) |
|
Redefinition of
addRelatedPart
Adds $part to the list of parts and returns the Content-ID of the part.
Parameters
getMainPart
array(ezcMailPart) getMainPart(
)
Returns the main part of this multipart or null if there is no such part.
getRelatedPartByID
Returns the part associated with the passed Content-ID.
Parameters
| Name |
Type |
Description |
$cid |
string |
|
getRelatedParts
array(ezcMailPart) getRelatedParts(
)
Returns the mail parts associated with this multipart.
multipartType
string multipartType(
)
Returns "related".
Redefinition of
setMainPart
Sets the main part $part of this alternative multipart.
Parameters
Last updated: Mon, 27 Jul 2009