Mail: ezcMailTools
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMailTools
|
This class contains static convenience methods for composing addresses and ensuring correct line-breaks in the mail. [
source]
Constants
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 string |
mimeDecode(
$text, [$charset = 'utf-8'] )
Decodes mime encoded fields and tries to recover from errors. |
|
public static ezcMailAddress |
parseEmailAddress(
$address, [$encoding = "mime"] )
Returns an ezcMailAddress object parsed from the address string $address. |
|
public static array(ezcMailAddress) |
parseEmailAddresses(
$addresses, [$encoding = "mime"] )
Returns an array of ezcMailAddress objects parsed from the address string $addresses. |
|
public static ezcMail |
replyToMail(
$mail, $from, [$type = self::REPLY_SENDER], [$subjectPrefix = "Re: "] )
Returns a new mail object that is a reply to the current object. |
|
public static void |
setLineBreak(
$characters )
Sets the endLine $character(s) to use when generating mail. |
Methods
composeEmailAddress
Returns ezcMailAddress $item as a RFC822 compliant address string.
Parameters
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.
mimeDecode
string mimeDecode(
string
$text, [
$charset = 'utf-8'] )
Decodes mime encoded fields and tries to recover from errors.
Decodes the $text encoded as a MIME string to the $charset. In case the strict conversion fails this method tries to workaround the issues by trying to "fix" the original $text before trying to convert it.
Parameters
| Name |
Type |
Description |
$text |
string |
|
$charset |
|
|
parseEmailAddress
ezcMailAddress parseEmailAddress(
string
$address, [string
$encoding = "mime"] )
Returns an ezcMailAddress object parsed from the address string $address.
You can set the encoding of the name part with the $encoding parameter. If $encoding is omitted or set to "mime" parseEmailAddress will asume that the name part is mime encoded.
This method does not perform validation. It will also accept slightly malformed addresses.
If the mail address given can not be decoded null is returned.
Parameters
| Name |
Type |
Description |
$address |
string |
|
$encoding |
string |
|
parseEmailAddresses
array(ezcMailAddress) parseEmailAddresses(
string
$addresses, [string
$encoding = "mime"] )
Returns an array of ezcMailAddress objects parsed from the address string $addresses.
You can set the encoding of the name parts with the $encoding parameter. If $encoding is omitted or set to "mime" parseEmailAddresses will asume that the name parts are mime encoded.
Parameters
| Name |
Type |
Description |
$addresses |
string |
|
$encoding |
string |
|
replyToMail
Returns a new mail object that is a reply to the current object.
The new mail will have the correct to, cc, bcc and reference headers set. It will not have any body set.
By default the reply will only be sent to the sender of the original mail. If $type is set to REPLY_ALL, all the original recipients will be included in the reply.
Use $subjectPrefix to set the prefix to the subject of the mail. The default is to prefix with 'Re: '.
Parameters
| Name |
Type |
Description |
$from |
ezcMailAddress |
|
$type |
int |
REPLY_SENDER or REPLY_ALL |
$subjectPrefix |
string |
|
$mail |
ezcMail |
|
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: Wed, 28 Nov 2007