Make WordPress Core

Changeset 49844

Timestamp:
12/20/2020 03:07:23 PM (4 years ago)
Author:
johnbillion
Message:

Mail: Introduce a pre_wp_mail filter to allow short-circuiting the wp_mail() function without having to override the pluggable function.

Props DvanKooten, swissspidy, SergeyBiryukov, jtsternberg, ericlewis, Mte90, birgire, ayeshrajans

Fixes #35069

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r49692 r49844  
    162162     * @global PHPMailer\PHPMailer\PHPMailer $phpmailer
    163163     *
    164      * @param string|array $to          Array or comma-separated list of email addresses to send message.
    165      * @param string       $subject     Email subject
    166      * @param string       $message     Message contents
    167      * @param string|array $headers     Optional. Additional headers.
    168      * @param string|array $attachments Optional. Paths to files to attach.
    169      * @return bool Whether the email contents were sent successfully.
     164     * @param string| $to          Array or comma-separated list of email addresses to send message.
     165     * @param string       
     166     * @param string       
     167     * @param string| $headers     Optional. Additional headers.
     168     * @param string| $attachments Optional. Paths to files to attach.
     169     * @return bool Whether the email sent successfully.
    170170     */
    171171    function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
     
    188188         */
    189189        $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
    190216
    191217        if ( isset( $atts['to'] ) ) {
  • trunk/tests/phpunit/tests/mail.php

    r48937 r49844  
    416416        $this->assertTrue( $phpmailer->validateAddress( 'foo@192.168.1.1' ), 'Assert PHPMailer accepts IP address email addresses' );
    417417    }
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
    418434}
Note: See TracChangeset for help on using the changeset viewer.