\SSilence\ImapClientIncomingMessage

Class for all incoming messages

This class get message and generates a message structure of the form:

$incomingMessage = new IncomingMessage();
$incomingMessage->header;
$incomingMessage->message;
$incomingMessage->attachments;
$incomingMessage->section;
$incomingMessage->structure;
$incomingMessage->debug;

And marks the message read.

Summary

Methods
Properties
Constants
__construct()
debug()
getSection()
getSectionStructure()
__debugInfo()
$header
$message
$attachments
$section
$structure
$debug
SECTION_ATTACHMENTS
SECTION_BODY
NOT_DECODE
DECODE
No protected methods found
No protected properties found
N/A
init()
getHeader()
getCountSection()
getRecursiveSections()
getSections()
getAttachments()
getBody()
getSectionStructureFromIncomingStructure()
getObjectStructureFromParts()
imapFetchbody()
imapFetchstructure()
imapBodystruct()
imapFetchOverview()
imapHeaderInfo()
convertToUtf8()
imapMimeHeaderDecode()
mimeHeaderDecode()
decode()
decodeHeader()
decodeAttachments()
decodeBody()
$imapStream
$id
$uid
$countAttachment
$_decode
N/A

Constants

SECTION_ATTACHMENTS

SECTION_ATTACHMENTS

Used to handle sections of the e-mail easier

SECTION_BODY

SECTION_BODY

Used to handle sections of the e-mail easier

NOT_DECODE

NOT_DECODE

Do not use decode incoming message

DECODE

DECODE

Use decode incoming message

Properties

$header

$header : object

Header of the message

Type

object

$message

$message : object

The message

Type

object

$attachments

$attachments : array

Attachments

Type

array

$section

$section : string|array

Section of the message

Type

string|array

$structure

$structure : object

Structure of the message

Type

object

$debug

$debug : object

Debug on or off

Type

object

$imapStream

$imapStream : resource

The imap string

Type

resource

$id

$id : integer

ID of the message

Type

integer

$uid

$uid : integer

UID of the message

Type

integer

$countAttachment

$countAttachment : integer

Count the attachments

Type

integer

$_decode

$_decode : string

Disable/enable decode current incoming message

Type

string

Methods

__construct()

__construct(resource  $imapStream, integer  $id, string  $decode = self::DECODE) : \SSilence\ImapClient\IncomingMessage

Called when the class has a new instance made of it

Parameters

resource $imapStream
integer $id
string $decode

Returns

\SSilence\ImapClient\IncomingMessage

debug()

debug() : void

Returns current object

Set $this->debug

getSection()

getSection(string  $section, array|null  $options = null) : \SSilence\ImapClient\Section

Get a section message

Return object with 2 properties: $obj->structure $obj->body

Parameters

string $section
array|null $options

have one option $options['class']. It create object, which must be instance \SSilence\ImapClient\Section.

Throws

\SSilence\ImapClient\ImapClientException

Returns

\SSilence\ImapClient\Section

object

getSectionStructure()

getSectionStructure(string  $section) : object|null

Alias for getSectionStructureFromIncomingStructure();

Parameters

string $section

Returns

object|null

__debugInfo()

__debugInfo() : array

Info about this object

Returns

array

init()

init() : void

Main process

getHeader()

getHeader() : void

Get headers in the current message

Set

$this->header
$this->header->details

getCountSection()

getCountSection() : array

Get count section

We take $this->section and make a simple array from an array of arrays. If getRecursiveSections($this->structure) set $this->section to NULL, then we think that there is only one section in the letter. We install $this->section[0] = [0], and then we will take this into account in subsequent processing. Namely here getSection() and $this->getSectionStructure() or getSectionStructureFromIncomingStructure(). Because if the message id is correct and the structure is returned, then there is exactly one section in the message.

Returns

array —

sections

getRecursiveSections()

getRecursiveSections(object  $obj, string  $before = null) : void

Bypasses the recursive parts current message

Counts sections based on $obj->parts. And sets $this->section as an array of arrays or null. Null if $obj->parts is not.

Parameters

object $obj
string $before

getSections()

getSections(string  $type = null) : array

Gets all sections, or if parameter is specified sections by type

Parameters

string $type

Throws

\SSilence\ImapClient\ImapClientException

Returns

array

getAttachments()

getAttachments() : array

Get attachments in the current message

Set $this->attachments->name $this->attachments->body $this->attachments->info

Returns

array

getBody()

getBody() : object

Get body current message

Set $this->message->$subtype $this->message->$subtype->charset $this->message->text $this->message->info[] $this->message->types[]

Returns

object

getSectionStructureFromIncomingStructure()

getSectionStructureFromIncomingStructure(string  $section) : object|null

Get section structure from incoming structure

Parameters

string $section

Returns

object|null

getObjectStructureFromParts()

getObjectStructureFromParts(object  $inObject, integer  $part) : object

Get object structure from parts

Parameters

object $inObject
integer $part

Returns

object

imapFetchbody()

imapFetchbody(string  $section) : string

Get a specific section

Parameters

string $section

Returns

string

imapFetchstructure()

imapFetchstructure() : object

Structure all messages

Returns

object

imapBodystruct()

imapBodystruct(string  $section) : object

Structure specific section

Parameters

string $section

Returns

object

imapFetchOverview()

imapFetchOverview() : object

Fetch a quick "Overview" on a message

Throws

\SSilence\ImapClient\ImapClientException

Returns

object

convertToUtf8()

convertToUtf8(string  $str) : string

Convert to utf8 if necessary.

Parameters

string $str

utf8 encoded string

Returns

string

imapMimeHeaderDecode()

imapMimeHeaderDecode(string  $string) : array

Wrapper for imap_mime_header_decode() http://php.net/manual/ru/function.imap-mime-header-decode.php

Parameters

string $string

Returns

array

mimeHeaderDecode()

mimeHeaderDecode(string  $string) : string

Decodes and glues the title bar http://php.net/manual/ru/function.imap-mime-header-decode.php

Parameters

string $string

Returns

string

decode()

decode() : void

Decode incoming message

decodeHeader()

decodeHeader() : void

Decode header

decodeAttachments()

decodeAttachments() : void

Decode attachments

decodeBody()

decodeBody() : void

Decode body