imap_mail

FunctionRemoved in PHP 8.4

Send an email message.

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

imap_mail Function synopsis

imap_mail(
    string $to,
    string $subject,
    string $message,
    ?string $additional_headers = null,
    ?string $cc = null,
    ?string $bcc = null,
    ?string $return_path = null
  ): bool

Parameters

$to

Typestring

The receiver

$subject

Typestring

The mail subject

$message

Typestring

The mail body, see imap_mail_compose

$additional_headers

OptionalType?stringDefault valuenull

As string with additional headers to be set on the mail

$cc

OptionalType?stringDefault valuenull

$bcc

OptionalType?stringDefault valuenull

The receivers specified in $bcc will get the mail, but are excluded from the headers.

$return_path

OptionalType?stringDefault valuenull

Use this parameter to specify return path upon mail delivery failure. This is useful when using PHP as a mail client for multiple users.

Return value

Typebool

Returns true on success, false on failure

Changes to the imap_mail Function

PHP 8.4

  • Function removed

PHP 8.0

  • Return type added: bool
  • Parameter type added for parameter #1 ($to): string
  • Parameter type added for parameter #2 ($subject): string
  • Parameter type added for parameter #3 ($message): string
  • Parameter type added for parameter #4 ($additional_headers): ?string
  • Parameter default value added for position #4 ($additional_headers): null
  • Parameter type added for parameter #5 ($cc): ?string
  • Parameter default value added for position #5 ($cc): null
  • Parameter type added for parameter #6 ($bcc): ?string
  • Parameter default value added for position #6 ($bcc): null
  • Parameter name of parameter #7 changed: $rpath to $return_path
  • Parameter type added for parameter #7 ($return_path): ?string
  • Parameter default value added for position #7 ($return_path): null
  imap_mail(
-     $to,
+     string $to,
-     $subject,
+     string $subject,
-     $message,
+     string $message,
-     $additional_headers,
+     ?string $additional_headers = null,
-     $cc,
+     ?string $cc = null,
-     $bcc,
+     ?string $bcc = null,
-     $rpath
+     ?string $return_path = null
-   )
+   ): bool

imap_mail 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