• Resolved SpartakusMd

    (@spartakusmd)


    Hello,

    Could the receivers to be added to the phpMailer? I’m creating a plugin which uses phpmailer_init action and tries to get the data from phpMailer, but the receivers are not added. This is what I came up with (taken from WordPress’ phpMailer), to be added after extract( apply_filters( 'wp_mail', ... ) )

    if ( ! is_array( $to ) ) {
    	$to = explode( ',', $to );
    }
    
    foreach ($to as $address) {
    	$recipient_name = '';
    	if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
    		if ( count( $matches ) === 3 ) {
    			$recipient_name = $matches[1];
    			$address = $matches[2];
    		}
    	}
    
    	$this->phpmailer->addAddress($address, $recipient_name);
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The receivers are not added to the phpMailer instance’ is closed to new replies.