imap_open

FunctionRemoved in PHP 8.4

Open an IMAP stream to a mailbox.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2
Changed
PHP 8.3
PHP 8.4
Removed
PHP 8.5
PHP 8.6

imap_open Function synopsis

imap_open(
    string $mailbox,
    string $user,
    string $password,
    int $flags = 0,
    int $retries = 0,
    array $options = []
  ): IMAP\Connection|false

Parameters

$mailbox

Typestring

A mailbox name consists of a server and a mailbox path on this server. The special name INBOX stands for the current users personal mailbox. Mailbox names that contain international characters besides those in the printable ASCII space have to be encoded with imap_utf7_encode.

$user

Typestring

The user name

$password

Typestring

The password associated with the $user

$flags

OptionalTypeintDefault value0

The $flags are a bit mask with one or more of the following:

$retries

OptionalTypeintDefault value0

Number of maximum connect attempts

$options

OptionalTypearrayDefault value[]

Connection parameters, the following (string) keys maybe used to set one or more connection parameters:

Return value

TypeIMAP\Connection|false

Returns an IMAP\Connection instance on success, or false on failure.

Changes to the imap_open Function

PHP 8.4

  • Function removed

PHP 8.2

PHP 8.1

  • Return type added: IMAP\Connection|false
  imap_open(
      string $mailbox,
      string $user,
      string $password,
      int $flags = 0,
      int $retries = 0,
      array $options = []
-   )
+   ): IMAP\Connection|false

PHP 8.0

  • Parameter type added for parameter #1 ($mailbox): string
  • Parameter type added for parameter #2 ($user): string
  • Parameter type added for parameter #3 ($password): string
  • Parameter name of parameter #4 changed: $options to $flags
  • Parameter type added for parameter #4 ($flags): int
  • Parameter default value added for position #4 ($flags): 0
  • Parameter name of parameter #5 changed: $n_retries to $retries
  • Parameter type added for parameter #5 ($retries): int
  • Parameter default value added for position #5 ($retries): 0
  • Parameter name of parameter #6 changed: $params to $options
  • Parameter type added for parameter #6 ($options): array
  • Parameter default value added for position #6 ($options): []
  imap_open(
-     $mailbox,
+     string $mailbox,
-     $user,
+     string $user,
-     $password,
+     string $password,
-     $options,
+     int $flags = 0,
-     $n_retries,
+     int $retries = 0,
-     $params
+     array $options = []
    )

imap_open Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release No
PHP 8.5Supported (Latest) No
PHP 8.4Supported No
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes