Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/06/2019 12:02:53 AM (5 years ago)
Author:
johnjamesjacoby
Message:

Emails: chunk notification emails into 40 Bcc'd recipients.

This commit introduces the bbp_mail subfilter, used to target bbPress specific emails in conjunction with bbp_get_email_header() to help identify emails that came specifically from bbPress actions.

The purpose of this change is to help forum owners avoid their outbound emails being marked as spam, due to the high number of users that can be subscribed to any given forum or topic.

This change (combined with r6725) goes a long way towards improving the success of subscription emails reaching their intended recipients.

Fixes #3260. Props danielbachhuber.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/sub-actions.php

    r6876 r6919  
    524524    return (array) apply_filters( 'bbp_map_meta_caps', $caps, $cap, $user_id, $args );
    525525}
     526
     527/**
     528 * Filter the arguments used by wp_mail for bbPress specific emails
     529 *
     530 * @since 2.6.0 bbPress (r6918)
     531 *
     532 * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
     533 *                    subject, message, headers, and attachments values.
     534 *
     535 * @return array Array of capabilities
     536 */
     537function bbp_mail( $args = array() ) {
     538
     539    // Bail if headers are missing/malformed
     540    if ( empty( $args['headers'] ) || ! is_array( $args['headers'] ) ) {
     541        return $args;
     542    }
     543
     544    // Header to search all headers for
     545    $bbp_header = bbp_get_email_header();
     546
     547    // Bail if no bbPress header found
     548    if ( false === array_search( $bbp_header, $args['headers'], true ) ) {
     549        return $args;
     550    }
     551
     552    // Filter & return
     553    return (array) apply_filters( 'bbp_mail', $args );
     554}
Note: See TracChangeset for help on using the changeset viewer.