Path

ez components / documentation / api reference / 1.0 / mail


eZ Components 1.0

Mail: ezcMailTools

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcMailTools

This class contains static convenience methods for composing addresses and ensuring correct linebreaks in the mail. [source]

Method Summary

public static string composeEmailAddress( $item )
Returns ezcMailAddress $item as a RFC822 compliant address string.
public static string composeEmailAddresses( $items )
Returns the array $items consisting of ezcMailAddress objects as one RFC822 compliant address string.
public static string generateContentId( [$partName = "part"] )
Returns an unique ID to be used for Content-ID headers.
public static string generateMessageId( $hostname )
Returns an unique message ID to be used for a mail message.
public static string lineBreak( )
Returns one endLine character.
public static void setLineBreak( $characters )
Sets the endLine $character(s) to use when generating mail.

Methods

composeEmailAddress

string composeEmailAddress( ezcMailAddress $item )
Returns ezcMailAddress $item as a RFC822 compliant address string.
Example:
1.  composeEmailAddressnew ezcMailAddress'sender@example.com''John Doe' ) );
Returns:
 John Doe 

Parameters

Name Type Description
$item ezcMailAddress  

composeEmailAddresses

string composeEmailAddresses( $items )
Returns the array $items consisting of ezcMailAddress objects as one RFC822 compliant address string.

Parameters

Name Type Description
$items array(ezcMailAddress)  

generateContentId

string generateContentId( [string $partName = "part"] )
Returns an unique ID to be used for Content-ID headers.
The part $partName is default set to "part". Another value can be used to provide, for example, a file name of a part.
The formula used is [$partName]."@".[time].[counter]

Parameters

Name Type Description
$partName string  

generateMessageId

string generateMessageId( string $hostname )
Returns an unique message ID to be used for a mail message.
The hostname $hostname will be added to the unique ID as required by RFC822. If an e-mail address is provided instead, the hostname is extracted and used.
The formula to generate the message ID is: [time_and_date].[process_id].[counter]

Parameters

Name Type Description
$hostname string  

lineBreak

string lineBreak( )
Returns one endLine character.
The default is to use "\n\r" as specified by RFC 2045.

setLineBreak

void setLineBreak( string $characters )
Sets the endLine $character(s) to use when generating mail.
The default is to use "\r\n" as specified by RFC 2045.

Parameters

Name Type Description
$characters string  

Last updated: Thu, 31 Jan 2008