A Mailbox Address MIME Header for something like From or Sender.
Methods
Creates a new MailboxHeader with $name.
__construct(string $name, \Swift_Mime_HeaderEncoder $encoder, \Swift_Mime_Grammar $grammar)
Returns a string representation of this object.
__toString() : string
Inherited
| see |
\toString() |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::__toString() |
Returns
string
Get all email addresses in this Header.
getAddresses() : string[]
Get the character set used in this Header.
getCharset() : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getCharset() |
Returns
string
Get the encoder used for encoding this Header.
getEncoder() : \Swift_Mime_HeaderEncoder
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getEncoder() |
Returns
Get the string value of the body in this Header.
getFieldBody() : string
This is not necessarily RFC 2822 compliant since folding white space will
not be added at this stage (see toString() for that).
Exceptions
Returns
string
Get the model for the field body.
getFieldBodyModel() : array
Get the name of this header (e.g.
getFieldName() : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getFieldName() |
Returns
string
Get the type of Header that this instance represents.
getFieldType() : int
Get the grammar used for this Header.
getGrammar() : \Swift_Mime_Grammar
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getGrammar() |
Returns
Get the language used in this Header.
getLanguage() : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getLanguage() |
Returns
string
Get the maximum permitted length of lines in this Header.
getMaxLineLength() : int
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getMaxLineLength() |
Returns
int
Get the full mailbox list of this Header as an array of valid RFC 2822 strings.
getNameAddressStrings() : string[]
Example:
'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn')
);
print_r($header->getNameAddressStrings());
// array (
// 0 => Chris Corbyn ,
// 1 => Mark Corbyn
// )
?>
Exceptions
Returns
string[]
Get all mailboxes in this Header as key=>value pairs.
getNameAddresses() : string[]
The key is the address and the value is the name (or null if none set).
Example:
'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn')
);
print_r($header->getNameAddresses());
// array (
// chris@swiftmailer.org => Chris Corbyn,
// mark@swiftmailer.org => Mark Corbyn
// )
?>
Returns
string[]
Remove one or more addresses from this Header.
removeAddresses(string | string[] $addresses)
Parameters
$addresses
stringstring[]
Makes this Header represent a list of plain email addresses with no names.
setAddresses(string[] $addresses)
Example:
setAddresses(
array('one@domain.tld', 'two@domain.tld', 'three@domain.tld')
);
?>
Parameters
$addresses
string[]
Exceptions
Set the character set used in this Header.
setCharset(string $charset)
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setCharset() |
Parameters
$charset
string
Set the encoder used for encoding the header.
setEncoder(\Swift_Mime_HeaderEncoder $encoder)
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setEncoder() |
Parameters
Set the model for the field body.
setFieldBodyModel(mixed $model)
This method takes a string, or an array of addresses.
Parameters
$model
mixed
Exceptions
Set the grammar used for the header.
setGrammar(\Swift_Mime_Grammar $grammar)
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setGrammar() |
Parameters
Set the language used in this Header.
setLanguage(string $lang)
Inherited
For example, for US English, 'en-us'.
This can be unspecified.
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setLanguage() |
Parameters
$lang
string
Set the maximum length of lines in the header (excluding EOL).
setMaxLineLength(int $lineLength)
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setMaxLineLength() |
Parameters
$lineLength
int
Set a list of mailboxes to be shown in this Header.
setNameAddresses(string | string[] $mailboxes)
The mailboxes can be a simple array of addresses, or an array of
key=>value pairs where (email => personalName).
Example:
setNameAddresses(array(
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' //No associated personal name
));
?>
Parameters
$mailboxes
stringstring[]
Exceptions
Get this Header rendered as a RFC 2822 compliant string.
toString() : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::toString() |
Exceptions
Returns
string
Clear the cached value if $condition is met.
clearCachedValueIf(boolean $condition)
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::clearCachedValueIf() |
Parameters
$condition
boolean
Produces a compliant, formatted display-name based on the string given.
createDisplayNameString(string $displayName, boolean $shorten) : string
Parameters
$displayName
stringas displayed
$shorten
booleanthe first line to make remove for header name
Returns
string
Creates a string form of all the mailboxes in the passed array.
createMailboxListString(array $mailboxes) : string
Parameters
$mailboxes
string[]
Exceptions
Returns
string
Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
createPhrase(\Swift_Mime_Header $header, string $string, string $charset, \Swift_Mime_HeaderEncoder $encoder, boolean $shorten) : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::createPhrase() |
Parameters
$string
stringas displayed
$charset
stringof the text
$shorten
booleanthe first line to make remove for header name
Returns
string
Encode needed word tokens within a string of input.
encodeWords(\Swift_Mime_Header $header, string $input, $usedLength) : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::encodeWords() |
Parameters
$header
$input
string
$usedLength
Returns
string
Generates tokens from the given string which include CRLF as individual tokens.
generateTokenLines(string $token) : string[]
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::generateTokenLines() |
Parameters
$token
string
Returns
string[]
Get the value in the cache.
getCachedValue() : string
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getCachedValue() |
Returns
string
Splits a string into tokens in blocks of words which can be encoded quickly.
getEncodableWordTokens(string $string) : string[]
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getEncodableWordTokens() |
Parameters
$string
string
Returns
string[]
Get a token as an encoded word for safe insertion into headers.
getTokenAsEncodedWord(string $token, $firstLineOffset) : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::getTokenAsEncodedWord() |
Parameters
$firstLineOffset
Returns
string
Normalizes a user-input list of mailboxes into consistent key=>value pairs.
normalizeMailboxes(array $mailboxes) : string[]
Parameters
$mailboxes
string[]
Returns
string[]
Set a value into the cache.
setCachedValue(string $value)
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setCachedValue() |
Parameters
$value
string
Set the name of this Header field.
setFieldName(string $name)
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::setFieldName() |
Parameters
$name
string
Generate a list of all tokens in the final header.
toTokens(string $string) : array
Inherited
| access |
protected |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::toTokens() |
Parameters
$string
stringThe string to tokenize
Returns
arrayAn array of tokens as strings
Redefine the encoding requirements for mailboxes.
tokenNeedsEncoding(string $token) : boolean
Commas and semicolons are used to separate
multiple addresses, and should therefore be encoded
Parameters
$token
string
Returns
boolean
Throws an Exception if the address passed does not comply with RFC 2822.
_assertValidAddress(string $address)
Parameters
$address
string
Exceptions
Return an array of strings conforming the the name-addr spec of RFC 2822.
_createNameAddressStrings(array $mailboxes) : string[]
Parameters
$mailboxes
string[]
Returns
string[]
Takes an array of tokens which appear in the header and turns them into
an RFC 2822 compliant string, adding FWSP where needed.
_tokensToString(array $tokens) : string
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::_tokensToString() |
Parameters
$tokens
string[]
Returns
string
Properties
$_cachedValue : string
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_cachedValue |
$_charset : string
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_charset |
$_encoder : \Swift_Encoder
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_encoder |
$_grammar : \Swift_Mime_Grammar
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_grammar |
$_lang : string
Inherited
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_lang |
$_lineLength : int
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_lineLength |
$_name : string
Inherited
| access |
private |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::$$_name |
Constants
Date and time headers
TYPE_DATE
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_DATE |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_DATE |
Identification headers
TYPE_ID
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_ID |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_ID |
Mailbox and address headers
TYPE_MAILBOX
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_MAILBOX |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_MAILBOX |
Parameterized headers (text + params)
TYPE_PARAMETERIZED
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_PARAMETERIZED |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_PARAMETERIZED |
Address path headers
TYPE_PATH
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_PATH |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_PATH |
Text headers
TYPE_TEXT
Inherited
| inherited_from |
\Swift_Mime_Header::TYPE_TEXT |
| inherited_from |
\Swift_Mime_Headers_AbstractHeader::TYPE_TEXT |