Mail: ezcMail
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMail
|
The main mail class. [
source]
You can use ezcMail together with the other classes derived from ezcMailPart to build email messages. When the mail is built, use the Transport classes to send the mail.
This example builds and sends a simple text mail message:
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 = "Hi";
5. $mail->body = new ezcMailText( "I just mail to say I love you!" );
6. $transport = new ezcMailTransportMta();
7. $transport->send( $mail );
You can also derive your own mail classes from this class if you have special requirements. An example of this is the ezcMailComposer class which is a convenience class to send simple mail structures and HTML mail.
The ezcMail class has the following properties:
- from ezcMailAddress, contains the from address as an ezcMailaddress object.
- to array(ezcMailAddress), contains an array of ezcMailAddress objects.
- cc array(ezcMailAddress), contains an array of ezcMailAddress objects.
- bcc array(ezcMailAddress), contains an array of ezcMailAddress objects.
- subject string, contains the subject of the e-mail. Use setSubject if you require a special encoding.
- subjectEncoding string The encoding of the subject.
- body ezcMailPart the body part of the message.
{@, describes the encoding of charactersets in header.
}}
Parents
ezcMailPart
|
--ezcMail
Descendents
| Child Class |
Description |
| ezcMailComposer |
Convenience class for writing mail.
|
Constants
Method Summary
|
public ezcMail |
__construct(
)
Constructs an empty ezcMail object. |
|
public void |
addBcc(
$address )
Adds the ezcMailAddress $address to the list of 'bcc' recipients. |
|
public void |
addCc(
$address )
Adds the ezcMailAddress $address to the list of 'cc' recipients. |
|
public void |
addTo(
$address )
Adds the ezcMailAddress $address to the list of 'to' recipients. |
|
public string |
generateBody(
)
Returns the generated body part of this mail. |
|
public string |
generateHeaders(
)
Returns the generated headers for the mail. |
|
public mixed |
__get(
$name )
Returns the property $name. |
|
public void |
__set(
$name, $value )
Sets the property $name to $value. |
Inherited Methods
From
ezcMailPart :
Methods
__construct
ezcMail __construct(
)
Constructs an empty ezcMail object.
Redefined in descendants as
addBcc
Adds the ezcMailAddress $address to the list of 'bcc' recipients.
Parameters
addCc
Adds the ezcMailAddress $address to the list of 'cc' recipients.
Parameters
addTo
Adds the ezcMailAddress $address to the list of 'to' recipients.
Parameters
generateBody
string generateBody(
)
Returns the generated body part of this mail.
Returns an empty string if no body has been set.
Redefinition of
generateHeaders
string generateHeaders(
)
Returns the generated headers for the mail.
This method is called automatically when the mail message is built. You can re-implement this method in subclasses if you wish to set different mail headers than ezcMail.
Redefinition of
__get
mixed __get(
string
$name )
Returns the property $name.
Parameters
| Name |
Type |
Description |
$name |
string |
|
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
if the property does not exist. |
Redefined in descendants as
__set
void __set(
string
$name, mixed
$value )
Sets the property $name to $value.
Parameters
| Name |
Type |
Description |
$name |
string |
|
$value |
mixed |
|
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
if the property does not exist. |
Redefined in descendants as
Last updated: Thu, 31 Jan 2008