Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcMailMultipartRelated

Mail::ezcMailMultipartRelated

Class ezcMailMultipartRelated

ezcMailMultipartRelated is intended for mail parts consisting of several inter-related body parts.

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 );

Source for this file: /Mail/src/parts/multiparts/multipart_related.php

ezcMailPart
   |
   --ezcMailMultipart
      |
      --ezcMailMultipartRelated
Version:   //autogen//

Inherited Constants

From ezcMailMultipart:
ezcMailMultipart::DEFAULT_NO_MIME_MESSAGE    Default message displayed to non-MIME capable email clients.

Inherited Member Variables

From ezcMailMultipart
protected ezcMailMultipart::$parts
From ezcMailPart
protected ezcMailPart::$properties

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
public ezcMailMultipart ezcMailMultipart::__construct()
Constructs a new ezcMailMultipart with the parts $parts.
public string ezcMailMultipart::generateBody()
Returns the generated body for all multipart types.
protected static string ezcMailMultipart::generateBoundary()
Returns a unique boundary string.
public abstract string ezcMailMultipart::multipartType()
Returns the type of multipart.
From ezcMailPart
public ezcMailPart ezcMailPart::__construct()
Constructs a new mail part.
public void ezcMailPart::appendExcludeHeaders()
The array $headers will be excluded when the headers are generated.
public string ezcMailPart::generate()
Returns the complete mail part including both the header and the body as a string.
public abstract string ezcMailPart::generateBody()
Returns the body of this part as a string.
public string ezcMailPart::generateHeaders()
Returns the headers set for this part as a RFC 822 string.
public mixed ezcMailPart::getHeader()
Returns the RAW value of the header $name.
protected string ezcMailPart::getHeaderCharset()
Returns the charset registered for the header $name.
public void ezcMailPart::setHeader()
Sets the header $name to the value $value and its charset to $charset.
protected void ezcMailPart::setHeaderCharset()
Sets the charset of the header $name to $value.
public void ezcMailPart::setHeaders()
Adds the headers $headers.

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:
Method Description
ezcMailMultipart::__construct() Constructs a new ezcMailMultipart with the parts $parts.

addRelatedPart

string addRelatedPart( ezcMailPart $part )

Adds $part to the list of parts and returns the Content-ID of the part.

Parameters:
Name Type Description
$part ezcMailPart

getMainPart

array(ezcMailPart) getMainPart( )

Returns the main part of this multipart or null if there is no such part.

getRelatedPartByID

ezcMailPart getRelatedPartByID( string $cid )

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:
Method Description
ezcMailMultipart::multipartType() Returns the type of multipart.

setMainPart

void setMainPart( ezcMailPart $part )

Sets the main part $part of this alternative multipart.

Parameters:
Name Type Description
$part ezcMailPart
Documentation generated by phpDocumentor 1.4.3