Make WordPress Core

Changeset 48964


Ignore:
Timestamp:
09/09/2020 04:19:33 PM (6 years ago)
Author:
desrosj
Message:

Site Health: Allow attachments to be added to recovery mode emails.

The wp_mail() function has the ability to add attachments to emails. There is currently no way to add attachments to the recovery mode email sent out to site admins when a PHP error is encountered on their site.

This change adds that ability through the use of the recovery_mode_email filter, allowing developers to use the full capabilities of wp_mail().

Props desrosj, timothyblynjacobs.
Fixes #51276.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-recovery-mode-email-service.php

    r48962 r48964  
    195195
    196196                $email = array(
    197                         'to'      => $this->get_recovery_mode_email_address(),
     197                        'to'          => $this->get_recovery_mode_email_address(),
    198198                        /* translators: %s: Site title. */
    199                         'subject' => __( '[%s] Your Site is Experiencing a Technical Issue' ),
    200                         'message' => $message,
    201                         'headers' => '',
     199                        'subject'     => __( '[%s] Your Site is Experiencing a Technical Issue' ),
     200                        'message'     => $message,
     201                        'headers'     => '',
     202                        'attachments' => '',
    202203                );
    203204
     
    210211                 *     Used to build a call to wp_mail().
    211212                 *
    212                  *     @type string|array $to      Array or comma-separated list of email addresses to send message.
    213                  *     @type string       $subject Email subject
    214                  *     @type string       $message Message contents
    215                  *     @type string|array $headers Optional. Additional headers.
     213                 *     @type string|array $to          Array or comma-separated list of email addresses to send message.
     214                 *     @type string       $subject     Email subject
     215                 *     @type string       $message     Message contents
     216                 *     @type string|array $headers     Optional. Additional headers.
     217                 *     @type string|array $attachments Optional. Files to attach.
    216218                 * }
    217219                 * @param string $url   URL to enter recovery mode.
     
    223225                        wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ),
    224226                        $email['message'],
    225                         $email['headers']
     227                        $email['headers'],
     228                        $email['attachments']
    226229                );
    227230
Note: See TracChangeset for help on using the changeset viewer.