Mail: ezcMail
[ ]
[ Display-example ]
[ ]
[ ]
[ ]
[ ]
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.
There are several headers you can set on the mail object to achieve various effects:
- Reply-To - Set this to an email address if you want people to reply to an
address other than the from address.
- Errors-To - If the mail can not be delivered the error message will be
sent to this address.
Parents
ezcMailPart
|
--ezcMail
Descendents
| Child Class |
Description |
| ezcMailComposer |
Convenience class for writing mail.
|
Constants
Properties
|
array(ezcMailAddress) |
read/write
|
$bcc
Contains an array of ezcMailaddress objects. |
|
ezcMailPart |
read/write
|
$body
The body part of the message. |
|
array(ezcMailAddress) |
read/write
|
$cc
Contains an array of ezcMailaddress objects. |
|
ezcMailAddress |
read/write
|
$from
Contains the from address as an ezcMailaddress object. |
|
string |
read
|
$messageId
The message ID of the message. Treat as read-only unless you're 100% sure what you're doing. Also accessible through the deprecated property messageID. |
|
string |
read/write
|
$subject
Contains the subject of the e-mail. Use setSubject if you require a special encoding. |
|
string |
read/write
|
$subjectCharset
The encoding of the subject. |
|
integer |
read
|
$timestamp
The date/time of when the message was sent as Unix Timestamp. |
|
array(ezcMailAddress) |
read/write
|
$to
Contains an array of ezcMailaddress objects. |
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. |
Inherited Methods
From
ezcMailPart :
Methods
__construct
ezcMail __construct(
)
Constructs an empty ezcMail object.
Redefinition of
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
Last updated: Thu, 01 Nov 2007