WordPress.org

Make WordPress Core

Ticket #10420: 10420_3.patch

File 10420_3.patch, 982 bytes (added by nacin, 4 years ago)

Multiple recipients via array or comma-separated string

  • pluggable.php

     
    244244 * @uses PHPMailer 
    245245 * @ 
    246246 * 
    247  * @param string $to Email address to send message 
     247 * @param string|array $to Array or comma-separated list of email addresses to send message. 
    248248 * @param string $subject Email subject 
    249249 * @param string $message Message contents 
    250250 * @param string|array $headers Optional. Additional headers. 
     
    373373        $phpmailer->From = apply_filters( 'wp_mail_from', $from_email ); 
    374374        $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name ); 
    375375 
    376         // Set destination address 
    377         $phpmailer->AddAddress( $to ); 
     376        // Set destination addresses 
     377        $to = explode( ',', implode( ',', (array) $to ) ); 
     378        foreach ( (array) $to as $recipient ) { 
     379                $phpmailer->AddAddress( trim( $recipient ) ); 
     380        } 
    378381 
    379382        // Set mail's subject and body 
    380383        $phpmailer->Subject = $subject;