Mail: ezcMailMultipartAlternative
[ ]
[ Display example ] [ Mail listing example ] [ Rfcs ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMailMultipartAlternative
|
ezcMailMultipartAlternative is used to bundle a group of mail parts where only one should be shown. [
source]
This is useful e.g if you have a text in some fancy format but you also want to provide a backup plain text format to make sure everyone can read the mail. The alternatives should be added in an order of increasing faithfulness to the original content. In general, the best choice is the LAST part of a type supported by the recipients mail client.
The following example shows a HTML mail with a plain text backup in case the recipients client can't display HTML mail.
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. $plainText = new ezcMailText( "This is the plain text part" );
6. $htmlText = new ezcMailText( "<html>This is the HTML part</html>" );
7. $htmlText->subType = 'html';
8. $mail->body = new ezcMailMultipartAlternative( $plainText, $htmlText );
Parents
ezcMailPart
|
--ezcMailMultipart
|
--ezcMailMultipartAlternative
Inherited Member Variables
From
ezcMailMultipart:
Method Summary
|
public ezcMailMultipartAlternative |
__construct(
$... )
Constructs a new ezcMailMultipartAlternative |
|
public void |
appendPart(
$part )
Appends a part to the list of parts. |
|
public array(ezcMailPart) |
getParts(
)
Returns the mail parts associated with this multipart. |
|
public string |
multipartType(
)
Returns "alternative". |
Inherited Methods
From
ezcMailMultipart :
From
ezcMailPart :
Methods
__construct
ezcMailMultipartAlternative __construct(
ezcMailPart|array(ezcMailPart)
$... )
Constructs a new ezcMailMultipartAlternative
The constructor accepts an arbitrary number of ezcMailParts or arrays with ezcMailparts. Parts are added in the order provided. Parameters of the wrong type are ignored.
Parameters
| Name |
Type |
Description |
$... |
ezcMailPart|array(ezcMailPart) |
|
Redefinition of
appendPart
Appends a part to the list of parts.
Parameters
getParts
array(ezcMailPart) getParts(
)
Returns the mail parts associated with this multipart.
multipartType
string multipartType(
)
Returns "alternative".
Redefinition of
Last updated: Wed, 18 Jun 2008