Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Emails being sent to noreply@www.mysite.com for subscription emails

@lemmonaid

Participant

OK guys, probably not really relevant now, but I experience the same issue and found this thread.

Here is solution I use:

add_filter( 'wp_mail', function( $args = array() ) {
	/**
	 * If WordPress wants to send an email to bbp_get_do_not_reply_address() we check
	 * if $search_header is set. If it is, we take its value (email address) and set
	 * it as "to" address. Also we unset the $search_header.
	 */
	$search_header = 'Bcc:';

	if ( bbp_get_do_not_reply_address() === $args['to'] && is_array( $args['headers'] ) ) {
		foreach ( $args['headers'] as $key => $header ) {
			if ( false !== stripos( $header, $search_header ) ) {
				$args['to'] = trim( str_replace( $search_header, '', $header ) );
				unset( $args['headers'][ $key ] );
				break;
			}
		}
	}

	return $args;
} );
Skip to toolbar