Class ZMail

(line 43)

Description

Object
   |
   --Persistent
      |
      --Component
         |
         --ZMail

Located in File: /Zend/zmail.inc.php

A non-visual component to let you send e-mail easily

Use this component if you need to send e-mail in your application. This Zend Framework based component allows you to decide the transport (SMTP, Sendmail, etc) and provide properties to let you set the target of the e-mails, the Cc, the Bcc, etc. Is also able to send e-mail in HTML and include attachments.



Properties

Summary:
Attachments This property specifies the attachments you want to add to the e-mail
Bcc This property specifies the hidden copies of the e-mail
BodyHTML Use this property to specify the body of the e-mail in HTML format
BodyText Use this property to specify the body of the e-mail in plain-text format.
Cc This property specifies the copies of the e-mail
FromEmail It allows you to select the email of the sender
FromName It allows you to select the name of the sender of the e-mail
Headers If you need to add your custom headers to the message, use this property
Subject Specifies the subject of the e-mail to be sent
To This property specifies the targets of the e-mail
Transport Use this property to specify the transport to use to send the e-mail

Defined in class Component

Name Specifies the name for the component. The name is used as an identifier and should be unique.
Tag A versatile property of every Component that can be used in any way you want
ComponentCount Indicates the number of components owned by the component.
Components Lists all the components owned by this component.
ControlState A flag to know the state of the control, csLoading, csDesigning
DataFieldValue This property returns the value of the datafield if any.
NamePath Specifies the path to uniquely identify a component, qualified by the owner when required.
Owner Indicates the component that is responsible for streaming and freeing this component.

Defined in class Persistent

NamePath Used to serialize/unserialize. It returns the full path to identify this component.
Owner Owner of the component.

property Attachments (line 243)

array Attachments

This property specifies the attachments you want to add to the e-mail

This is an array property to allow you specify the attachments you want to add to the e-mail

The array has a form of:

  1.  array(
  2.  '0'=>'pathtothefile 1',
  3.  '0'=>'pathtothefile 2'
  4.  );

At design-time, you can use the property editor to make up this array.

By default, the attachments are interpreted as paths to the files you want to attach, but if you want to customize the attachments to include other information, or to customize the way attachments are handled, use the OnCustomizeAttachment, which let's you select the content, mimetype, disposition and filename for an attachment.


property Bcc (line 213)

array Bcc

This property specifies the hidden copies of the e-mail

This is an array property to allow you specify the extra hidden recipients of the e-mail you want to send.

The array has a form of:

  1.  array(
  2.  'e-mail 1'=>'recipient name 1',
  3.  'e-mail 2'=>'recipient name 2'
  4.  );

At design-time, you can use the property editor to make up this array.


property BodyHTML (line 69)

string BodyHTML

Use this property to specify the body of the e-mail in HTML format

You can use it in combination with BodyText to send a multipart e-mail in which the contents can be selected to be shown in plain-text or in HTML.


property BodyText (line 55)

string BodyText

Use this property to specify the body of the e-mail in plain-text format.

This property is a string property you can use to set the contents of the e-mail in plain-text format.


property Cc (line 188)

array Cc

This property specifies the copies of the e-mail

This is an array property to allow you specify the extra recipients of the e-mail you want to send.

The array has a form of:

  1.  array(
  2.  'e-mail 1'=>'recipient name 1',
  3.  'e-mail 2'=>'recipient name 2'
  4.  );

At design-time, you can use the property editor to make up this array.


property FromEmail (line 114)

string FromEmail

It allows you to select the email of the sender

Use it in combination with FromName to add e-mail of the sender

i.e. John Doe <john.doe@unknown.com>

John Doe is the FromName property, while john.doe@unknown.com is FromEmail


property FromName (line 97)

string FromName

It allows you to select the name of the sender of the e-mail

Use it in combination with FromEmail to add the real name of the sender

i.e. John Doe <john.doe@unknown.com>

John Doe is the FromName property, while john.doe@unknown.com is FromEmail


property Headers (line 319)

array Headers

If you need to add your custom headers to the message, use this property

This property allows you to add your own headers to the mail message, it's an array property in the form:

  1.  array(
  2.  '0'=>'header=value',
  3.  '1'=>'header=value'
  4.  );

You can use the same header name several times, so the values will be added


property Subject (line 80)

string Subject

Specifies the subject of the e-mail to be sent

property To (line 163)

array To

This property specifies the targets of the e-mail

This is an array property to allow you specify the recipients of the e-mail you want to send.

The array has a form of:

  1.  array(
  2.  'e-mail 1'=>'recipient name 1',
  3.  'e-mail 2'=>'recipient name 2'
  4.  );

At design-time, you can use the property editor to make up this array.


property Transport (line 132)

ZMailTransport Transport

Use this property to specify the transport to use to send the e-mail

By default, the sendmail method is used, is basically like using the PHP mail() function, this method is used if no transport is attached.

But you can also customize the process by using some ZMailTransport class, like ZMailTransportSMTP or ZMailTransportSendmail. Those components also have properties can be modified to customize the sending process.


property Name

Specifies the name for the component. The name is used as an identifier and should be unique.
This property is implemented in Component::Name

property Tag

A versatile property of every Component that can be used in any way you want
This property is implemented in Component::Tag

property ComponentCount

Indicates the number of components owned by the component.
This property is implemented in Component::ComponentCount

property Components

Lists all the components owned by this component.
This property is implemented in Component::Components

property ControlState

A flag to know the state of the control, csLoading, csDesigning
This property is implemented in Component::ControlState

property DataFieldValue

This property returns the value of the datafield if any.
This property is implemented in Component::DataFieldValue

property NamePath

Specifies the path to uniquely identify a component, qualified by the owner when required.
This property is implemented in Component::NamePath

property Owner

Indicates the component that is responsible for streaming and freeing this component.
This property is implemented in Component::Owner

property NamePath

Used to serialize/unserialize. It returns the full path to identify this component.
This property is implemented in Persistent::NamePath

property Owner

Owner of the component.
This property is implemented in Persistent::Owner

Methods

Summary:
loaded Initializes the component after the form file has been read into memory. [Overrides Component::loaded()]
send Sends the e-mail

Defined in class Component

dumpChildrenJavascript Dumps the javascript code for all the children
dumpFormItems Dumps code just after the form tag, useful to dump hidden fields for state retrieving for non visible components
dumpHeaderCode Dumps header code required
dumpJavascript Dumps the javascript code needed by this component
hasValidDataField Returns true if a valid data field is attached to the component
init Initializes a component
loaded Initializes the component after the form file has been read into memory.
loadedChildren Calls childrens loaded
preinit Method called before init()
serializeChildren Serializes all children
unserializeChildren Unserializes all children by calling unserialize for all the components

Defined in class Persistent

serialize Stores this object into the session.
unserialize This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call.

Defined in class Object

__construct Constructs an object and initializes its data before the object is first used.
className Returns a string indicating the type of the object instance (as opposed to the type of the variable passed as an argument).
classParent Returns the type of the immediate ancestor of a class.

Method loaded (line 136)

void loaded( )

Overrides : Component::loaded() Initializes the component after the form file has been read into memory.


Method send (line 329)

void send( )

Sends the e-mail

Use this method once all the properties and attachments are set. This method also fires the OnCustomizeAttachment when is adding attachments to the e-mail.


Events

Summary:
OnCustomizeAttachment This event allows you to customize how attachments are handled.

property OnCustomizeAttachment (line 296)

mixed OnCustomizeAttachment

This event allows you to customize how attachments are handled.

Use this event if you want to change the way attachments are handled, this event is fired just before add the attachment to the e-mail, and you get in $params the information of the attachment. Index key and name you set on the Attachments property.

To modify the way to handle an specific attachment, return an array with the new information.

The $params property has this form:

  1.  array(
  2.  '0'=>'attachment 1',
  3.  '1'=>'attachment 2'
  4.  );

You have to return an array which can have the following values:

  1.  array(
  2.  'body'=>'binary content for the attachment'// If this is not set, the contents will be gathered from a file
  3.  'mimetype'=>'type of the attachment',        // i.e.: image/gif, you can use the Zend_Mime constants
  4.  'disposition'=>'attachment',                 // You can use attachment or inline
  5.  'encodign'=>'base64',                        // You can use the Zend_Mime constants
  6.  'filename'=>'nameforthefile'                 // Name of the file to be shown
  7.  );

If some of the values are not present, the default value will be used.

  1.   function zmCustomCustomizeAttachment($sender$params)
  2.   {
  3.    $result=array();
  4.    list($key$attachment)=each($params);
  5.    if ($attachment=='index.php')
  6.    {
  7.        $result['mimetype']=Zend_Mime::TYPE_TEXT;
  8.        $result['disposition']=Zend_Mime::DISPOSITION_INLINE;
  9.    }
  10.    return($result);
  11.   }


Javascript Events

Summary:

[none]

Documentation generated on Fri, 26 Dec 2008 11:46:57 +0100 by phpDocumentor 1.4.0a2