interface ConnectionInterface (View source)

Methods

void
connect(string $host, int|null $port = null, array $options = [])

Open a new connection.

void
disconnect()

Close the current connection.

bool
connected()

Determine if the current session is connected.

login(string $user, string $password)

Send a "LOGIN" command.

void
logout()

Send a "LOGOUT" command.

authenticate(string $user, string $token)

Send an "AUTHENTICATE" command.

void
startTls()

Send a "STARTTLS" command.

idle(int $timeout)

Send an "IDLE" command.

void
done()

Send a "DONE" command.

noop()

Send a "NOOP" command.

expunge()

Send a "EXPUNGE" command.

capability()

Send a "CAPABILITY" command.

search(array $params)

Send a "SEARCH" command.

id(array|null $ids = null)

Send a "FETCH" command.

uid(int|array $ids, ImapFetchIdentifier $identifier)

Send a "FETCH UID" command.

bodyText(int|array $ids, bool $peek = true)

Send a "FETCH BODY[TEXT]" command.

bodyHeader(int|array $ids, bool $peek = true)

Send a "FETCH BODY[HEADER]" command.

bodyStructure(int|array $ids)

Send a "FETCH BODYSTRUCTURE" command.

bodyPart(string $partIndex, int|array $ids, bool $peek = false)

Send a "FETCH BODY[i]" command.

flags(int|array $ids)

Send a "FETCH FLAGS" command.

fetch(array|string $items, array|int $from, mixed $to = null, ImapFetchIdentifier $identifier = ImapFetchIdentifier::Uid)

Send a "FETCH" command.

size(int|array $ids)

Send a "RFC822.SIZE" command.

void
send(string $name, array $tokens = [], string|null $tag = null)

Send an IMAP command.

select(string $folder)

Send a "SELECT" command.

examine(string $folder)

Send a "EXAMINE" command.

list(string $reference = '', string $folder = '*')

Send a "LIST" command.

status(string $folder, array $arguments = ['MESSAGES', 'UNSEEN', 'RECENT', 'UIDNEXT', 'UIDVALIDITY'])

Send a "STATUS" command.

store(array|string $flags, array|int $from, int|null $to = null, string|null $mode = null, bool $silent = true, string|null $item = null)

Send a "STORE" command.

append(string $folder, string $message, array|null $flags = null)

Send a "APPEND" command.

copy(string $folder, array|int $from, int|null $to = null)

Send a "UID COPY" command.

move(string $folder, array|int $from, int|null $to = null)

Send a "UID MOVE" command.

create(string $folder)

Send a "CREATE" command.

delete(string $folder)

Send a "DELETE" command.

rename(string $oldPath, string $newPath)

Send a "RENAME" command.

subscribe(string $folder)

Send a "SUBSCRIBE" command.

unsubscribe(string $folder)

Send a "UNSUBSCRIBE" command.

quota(string $root)

Send a "GETQUOTA" command.

quotaRoot(string $mailbox)

Send a "GETQUOTAROOT" command.

Details

void connect(string $host, int|null $port = null, array $options = [])

Open a new connection.

Parameters

string $host
int|null $port
array $options

Return Value

void

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-state-and-flow-diagram

void disconnect()

Close the current connection.

Return Value

void

bool connected()

Determine if the current session is connected.

Return Value

bool

TaggedResponse login(string $user, string $password)

Send a "LOGIN" command.

Login to a new session.

Parameters

string $user
string $password

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-login-command

void logout()

Send a "LOGOUT" command.

Logout of the current server session.

TaggedResponse authenticate(string $user, string $token)

Send an "AUTHENTICATE" command.

Authenticate the current session.

Parameters

string $user
string $token

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-authenticate-command

void startTls()

Send a "STARTTLS" command.

Upgrade the current plaintext connection to a secure TLS-encrypted connection.

Generator idle(int $timeout)

Send an "IDLE" command.

Parameters

int $timeout

Return Value

Generator

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-idle-command

void done()

Send a "DONE" command.

ResponseCollection expunge()

Send a "EXPUNGE" command.

Apply session saved changes to the server.

UntaggedResponse capability()

Send a "CAPABILITY" command.

Get the mailbox's available capabilities.

Send a "SEARCH" command.

Execute a search request.

UntaggedResponse id(array|null $ids = null)

Send a "FETCH" command.

Exchange identification information.

Parameters

array|null $ids

Return Value

UntaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc2971.

ResponseCollection uid(int|array $ids, ImapFetchIdentifier $identifier)

Send a "FETCH UID" command.

Fetch message UIDs using the given message numbers.

Parameters

int|array $ids
ImapFetchIdentifier $identifier

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-uid-command

ResponseCollection bodyText(int|array $ids, bool $peek = true)

Send a "FETCH BODY[TEXT]" command.

Fetch message text contents.

Parameters

int|array $ids
bool $peek

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.5-9.9

ResponseCollection bodyHeader(int|array $ids, bool $peek = true)

Send a "FETCH BODY[HEADER]" command.

Fetch message headers.

Parameters

int|array $ids
bool $peek

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.5-9.9

ResponseCollection bodyStructure(int|array $ids)

Send a "FETCH BODYSTRUCTURE" command.

Fetch message body structure.

ResponseCollection bodyPart(string $partIndex, int|array $ids, bool $peek = false)

Send a "FETCH BODY[i]" command.

Fetch a specific part of the message BODY, such as BODY[1], BODY[1.2], etc.

Parameters

string $partIndex
int|array $ids
bool $peek

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.5-9.9

ResponseCollection flags(int|array $ids)

Send a "FETCH FLAGS" command.

Fetch a message flags.

ResponseCollection fetch(array|string $items, array|int $from, mixed $to = null, ImapFetchIdentifier $identifier = ImapFetchIdentifier::Uid)

Send a "FETCH" command.

Fetch one or more items for one or more messages.

Parameters

array|string $items
array|int $from
mixed $to
ImapFetchIdentifier $identifier

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-fetch-command

ResponseCollection size(int|array $ids)

Send a "RFC822.SIZE" command.

Fetch message sizes for one or more messages.

void send(string $name, array $tokens = [], string|null $tag = null)

Send an IMAP command.

Parameters

string $name
array $tokens
string|null $tag

Return Value

void

ResponseCollection select(string $folder)

Send a "SELECT" command.

Select the specified folder.

ResponseCollection examine(string $folder)

Send a "EXAMINE" command.

Examine a given folder.

ResponseCollection list(string $reference = '', string $folder = '*')

Send a "LIST" command.

Get a list of available folders.

Parameters

string $reference
string $folder

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-list-command

UntaggedResponse status(string $folder, array $arguments = ['MESSAGES', 'UNSEEN', 'RECENT', 'UIDNEXT', 'UIDVALIDITY'])

Send a "STATUS" command.

Get the status of a given folder.

Parameters

string $folder
array $arguments

Return Value

UntaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-status-command

ResponseCollection store(array|string $flags, array|int $from, int|null $to = null, string|null $mode = null, bool $silent = true, string|null $item = null)

Send a "STORE" command.

Set message flags.

Parameters

array|string $flags
array|int $from
int|null $to
string|null $mode
bool $silent
string|null $item

Return Value

ResponseCollection

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-store-command

TaggedResponse append(string $folder, string $message, array|null $flags = null)

Send a "APPEND" command.

Append a new message to given folder.

Parameters

string $folder
string $message
array|null $flags

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-append-command

TaggedResponse copy(string $folder, array|int $from, int|null $to = null)

Send a "UID COPY" command.

Copy message set from current folder to other folder.

Parameters

string $folder
array|int $from
int|null $to

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-copy-command

TaggedResponse move(string $folder, array|int $from, int|null $to = null)

Send a "UID MOVE" command.

Move a message set from current folder to another folder.

Parameters

string $folder
array|int $from
int|null $to

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-move-command

ResponseCollection create(string $folder)

Send a "CREATE" command.

Create a new folder.

TaggedResponse delete(string $folder)

Send a "DELETE" command.

Delete a folder.

TaggedResponse rename(string $oldPath, string $newPath)

Send a "RENAME" command.

Rename an existing folder.

Parameters

string $oldPath
string $newPath

Return Value

TaggedResponse

See also

https://datatracker.ietf.org/doc/html/rfc9051#name-rename-command

TaggedResponse subscribe(string $folder)

Send a "SUBSCRIBE" command.

Subscribe to a folder.

TaggedResponse unsubscribe(string $folder)

Send a "UNSUBSCRIBE" command.

Unsubscribe from a folder.

UntaggedResponse quota(string $root)

Send a "GETQUOTA" command.

Retrieve quota information about a specific quota root.

ResponseCollection quotaRoot(string $mailbox)

Send a "GETQUOTAROOT" command.

Retrieve quota root information about a mailbox.