## Apache Zeta Components Manual :: Docs For Class ezcMailAddress

### Mail::ezcMailAddress

### Class ezcMailAddress

A container to store a mail address in RFC822 format.

The class ezcMailTools contains methods for transformation between several formats.

Source for this file: /Mail/src/structs/mail_address.php

    ezcBaseStruct
       |
       --ezcMailAddress

Version: | //autogentag//

### Member Variables

public mixed | `$charset` The character set used in the $name property. The characterset defaults to us-ascii.
public string | `$email` The email address of the recipient.
public string | `$name` The name of the recipient (optional).

### Method Summary

public static ezcMailAddress | `__set_state( $array )` Returns a new instance of this class with the data specified by $array.
public ezcMailAddress | `__construct( $email , [ $name = ''] , [ $charset = 'us-ascii'] )` Constructs a new ezcMailAddress with the mail address $email and the optional name $name.
public string | `__toString( )` Returns string representation of email address on string cast.

### Methods

#### __set_state

static ezcMailAddress __set_state( $array )

Returns a new instance of this class with the data specified by $array.

$array contains all the data members of this class in the form: array('member_name'=>value).

__set_state makes this class exportable with var_export. var_export() generates code, that calls this method when it is parsed with PHP.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$array` | array(string=>mixed) |

#### __construct

ezcMailAddress __construct( string $email , [string $name = ''] , [string $charset = 'us-ascii'] )

Constructs a new ezcMailAddress with the mail address $email and the optional name $name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$email` | string |
`$name` | string |
`$charset` | string |

#### __toString

string __toString( )

Returns string representation of email address on string cast.

Builds a representation in format "Name <email@example.com>", if name is present, else only "<email@example.com>", if name is not present. You can simply do echo with an object of type ezcMailAddress or (since PHP 5.2) explicitly cast it to string using (string) $object.

Documentation generated by phpDocumentor 1.4.3