Class Swift_Mime_Headers_MailboxHeader
A Mailbox Address MIME Header for something like From or Sender.
- Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
- Swift_Mime_Headers_MailboxHeader
Author: Chris Corbyn
Located at vendors/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
Methods summary
public
|
#
__construct( string $name,
Creates a new MailboxHeader with $name. |
public
integer
|
|
public
|
#
setFieldBodyModel( mixed $model )
Set the model for the field body. This method takes a string, or an array of addresses. |
public
array
|
#
getFieldBodyModel( )
Get the model for the field body. This method returns an associative array
like |
public
|
#
setNameAddresses( string|string[] $mailboxes )
Set a list of mailboxes to be shown in this Header. The mailboxes can be a simple array of addresses, or an array of key=>value pairs where (email => personalName). Example: <?php //Sets two mailboxes in the Header, one with a personal name $header->setNameAddresses(array( 'chris@swiftmailer.org' => 'Chris Corbyn', 'mark@swiftmailer.org' //No associated personal name )); ?> |
public
string[]
|
#
getNameAddressStrings( )
Get the full mailbox list of this Header as an array of valid RFC 2822 strings. Example: <?php $header = new Swift_Mime_Headers_MailboxHeader('From', array('chris@swiftmailer.org' => 'Chris Corbyn', 'mark@swiftmailer.org' => 'Mark Corbyn') ); print_r($header->getNameAddressStrings()); // array ( // 0 => Chris Corbyn <chris@swiftmailer.org>, // 1 => Mark Corbyn <mark@swiftmailer.org> // ) ?> |
public
string[]
|
#
getNameAddresses( )
Get all mailboxes in this Header as key=>value pairs. The key is the address and the value is the name (or null if none set). Example: <?php $header = new Swift_Mime_Headers_MailboxHeader('From', array('chris@swiftmailer.org' => 'Chris Corbyn', 'mark@swiftmailer.org' => 'Mark Corbyn') ); print_r($header->getNameAddresses()); // array ( // chris@swiftmailer.org => Chris Corbyn, // mark@swiftmailer.org => Mark Corbyn // ) ?> |
public
|
#
setAddresses( string[] $addresses )
Makes this Header represent a list of plain email addresses with no names. Example: <?php //Sets three email addresses as the Header data $header->setAddresses( array('one@domain.tld', 'two@domain.tld', 'three@domain.tld') ); ?> |
public
string[]
|
|
public
|
|
public
string
|
#
getFieldBody( )
Get the string value of the body in this Header. This is not necessarily RFC
2822 compliant since folding white space will not be added at this stage (see
|
protected
string[]
|
#
normalizeMailboxes( array $mailboxes )
Normalizes a user-input list of mailboxes into consistent key=>value pairs. |
protected
string
|
#
createDisplayNameString( string $displayName, boolean $shorten = false )
Produces a compliant, formatted display-name based on the string given. |
protected
string
|
#
createMailboxListString( array $mailboxes )
Creates a string form of all the mailboxes in the passed array. |
protected
boolean
|
#
tokenNeedsEncoding( string $token )
Redefine the encoding requirements for mailboxes. Commas and semicolons are used to separate multiple addresses, and should therefore be encoded |
private
string[]
|
#
_createNameAddressStrings( array $mailboxes )
Return an array of strings conforming the the name-addr spec of RFC 2822. |
private
|
#
_assertValidAddress( string $address )
Throws an Exception if the address passed does not comply with RFC 2822. |
Methods inherited from Swift_Mime_Headers_AbstractHeader
__toString()
,
clearCachedValueIf()
,
createPhrase()
,
encodeWords()
,
generateTokenLines()
,
getCachedValue()
,
getCharset()
,
getEncodableWordTokens()
,
getEncoder()
,
getFieldName()
,
getGrammar()
,
getLanguage()
,
getMaxLineLength()
,
getTokenAsEncodedWord()
,
setCachedValue()
,
setCharset()
,
setEncoder()
,
setFieldName()
,
setGrammar()
,
setLanguage()
,
setMaxLineLength()
,
toString()
,
toTokens()
Magic methods summary
Constants summary
Constants inherited from Swift_Mime_Header
TYPE_DATE
,
TYPE_ID
,
TYPE_MAILBOX
,
TYPE_PARAMETERIZED
,
TYPE_PATH
,
TYPE_TEXT
Properties summary
private
string[]
|
$_mailboxes |
#
The mailboxes used in this Header. |