Path

ez components / documentation / api reference / 2009.1rc1 / mail


eZ Components 2009.1rc1

Mail: ezcMailAddress

[ Tutorial ] [ Display example ] [ Mail listing example ] [ Rfcs ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcMailAddress

A container to store a mail address in RFC822 format. [source]
The class ezcMailTools contains methods for transformation between several formats.

Parents

ezcBaseStruct
   |
   --ezcMailAddress

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

Methods

__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  

__set_state

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)  

__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.

Last updated: Mon, 22 Jun 2009