Copied!

Holds extra information about a parsed Received header part, for FROM and BY parts, namely: ehlo name, hostname, and address.

The parsed parts would be mapped as follows:

FROM ehlo name (hostname [address]), for example: FROM computer (domain.com [1.2.3.4]) would contain "computer" for getEhloName(), domain.com for getHostname and 1.2.3.4 for getAddress().

This doesn't change if the ehlo name is an address, it is still returned in getEhloName(), and not in getAddress(). Additionally square brackets are not stripped from getEhloName() if its an address. For example: "FROM [1.2.3.4]" would return "[1.2.3.4]" in a call to getEhloName().

For further information on how the header's parsed, check the documentation for {@see \ZBateson\MailMimeParser\Header\Consumer\Received\DomainConsumer}.

CloneableInstantiable
Methods
public __construct(Psr\Log\LoggerInterface $logger, ZBateson\MbWrapper\MbWrapper $charsetConverter, string $name, array $children)
 
  • param \HeaderPart[] $children
public ZBateson\MailMimeParser\Header\Part\HeaderPart::__toString() : string
 

Returns the value of the part (which is a string).

  • return string the value
public ZBateson\MailMimeParser\ErrorBag::addError(string $message, string $psrLogLevel, ?Throwable $exception = NULL) : static
public getAddress() : ?string
 

Returns the address of the server, or whatever string that looks like an address in the address position when parsing (but never a hostname).

public ZBateson\MailMimeParser\ErrorBag::getAllErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : array
public ZBateson\MailMimeParser\Header\Part\ContainerPart::getChildParts() : array
 

Returns the child parts this container part consists of.

  • return \IHeaderPart[]
public ZBateson\MailMimeParser\Header\Part\ContainerPart::getComments() : array
public getEhloName() : ?string
 

Returns the name used to identify the server in the first part of the extended-domain line.

Note that this is not necessarily the name used in the EHLO line to an SMTP server, since implementations differ so much, not much can be guaranteed except the position it was parsed in.

public ZBateson\MailMimeParser\ErrorBag::getErrorLoggingContextName() : string
 

Returns the class name. Override to identify objects in logs.

public ZBateson\MailMimeParser\ErrorBag::getErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : array
public getHostname() : ?string
 

Returns the hostname of the server, or whatever string in the hostname position when parsing (but never an address).

public ZBateson\MailMimeParser\Header\Part\NameValuePart::getName() : string
 

Returns the name of the name/value part.

public ZBateson\MailMimeParser\Header\Part\HeaderPart::getValue() : string
 

Returns the part's representative value after any necessary processing has been performed. For the raw value, call getRawValue().

public ZBateson\MailMimeParser\ErrorBag::hasAnyErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : bool
public ZBateson\MailMimeParser\ErrorBag::hasErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : bool
Properties
protected ?string $address = NULL
 
  • var string The address.
protected bool ZBateson\MailMimeParser\Header\Part\HeaderPart::$canIgnoreSpacesAfter = false
 
  • var bool set to true to ignore spaces after this part
protected bool ZBateson\MailMimeParser\Header\Part\HeaderPart::$canIgnoreSpacesBefore = false
 
  • var bool set to true to ignore spaces before this part
protected ZBateson\MbWrapper\MbWrapper ZBateson\MailMimeParser\Header\Part\HeaderPart::$charsetConverter
 
  • var \MbWrapper $charsetConverter the charset converter used for converting strings in HeaderPart::convertEncoding
protected ZBateson\MailMimeParser\Header\Part\ContainerPart::$children = []
 
  • var \HeaderPart[] parts that were used to create this part, collected for proper error reporting and validation.
protected ?string $ehloName = NULL
 
  • var string The name used to identify the server in the EHLO line.
protected ?string $hostname = NULL
 
  • var string The hostname.
protected bool ZBateson\MailMimeParser\Header\Part\HeaderPart::$isSpace = false
 

True if the part is a space token

protected Psr\Log\LoggerInterface ZBateson\MailMimeParser\ErrorBag::$logger
protected string ZBateson\MailMimeParser\Header\Part\NameValuePart::$name
 
  • var string the name of the part
protected string ZBateson\MailMimeParser\Header\Part\HeaderPart::$value
 
  • var string the representative value of the part after any conversion or processing has been done on it (e.g. removing new lines, converting, whatever else).
Methods
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::convertEncoding(string $str, string $from = 'ISO-8859-1', bool $force = false) : string
 

Ensures the encoding of the passed string is set to UTF-8.

The method does nothing if the passed $from charset is UTF-8 already, or if $force is set to false and mb_check_encoding for $str returns true for 'UTF-8'.

  • return string utf-8 string
protected ZBateson\MailMimeParser\Header\Part\ContainerPart::filterIgnoredSpaces(array $parts) : array
 

Filters out ignorable space tokens.

Spaces are removed if parts on either side of it have their canIgnoreSpaceAfter/canIgnoreSpaceBefore properties set to true.

  • param \HeaderPart[] $parts
  • return \HeaderPart[]
protected ZBateson\MailMimeParser\Header\Part\ContainerPart::getErrorBagChildren() : array
 

Returns this part's children, same as getChildParts().

  • return \ErrorBag
protected ZBateson\MailMimeParser\Header\Part\NameValuePart::getNameFromParts(array $parts) : string
 

Creates the string 'name' representation of this part constructed from the child name parts passed to it.

  • param \HeaderParts[] $parts
protected ZBateson\MailMimeParser\Header\Part\ContainerPart::getValueFromParts(array $parts) : string
 

Creates the string value representation of this part constructed from the child parts passed to it.

The default implementation filters out ignorable whitespace between parts, and concatenates parts calling 'getValue'.

  • param \HeaderParts[] $parts
protected ZBateson\MailMimeParser\Header\Part\NameValuePart::validate() : void
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration