Support » Plugin: Disable Emails » The receivers are not added to the phpMailer instance

  • 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 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.