Index: includes/common/classes.php
===================================================================
--- includes/common/classes.php	(revision 1220821)
+++ includes/common/classes.php	(working copy)
@@ -538,3 +538,225 @@
 	}
 }
 endif; // class_exists check
+
+if ( !class_exists( 'BBP_Subscriber_Notification' ) ) :
+/**
+ * Send subscription notification emails via WP Cron
+ *
+ * @package bbPress
+ * @subpackage Classes
+ *
+ * @since bbPress (r)
+ */
+class BBP_Subscriber_Notification {
+	public $subject;
+	public $message;
+	public $headers;
+	public $recipients;
+
+	protected function __construct( $recipients ) {
+		$this->recipients = $recipients;
+		$from = array(
+			'name' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
+			'address' => get_bloginfo( 'admin_email' )
+		);
+		$from = apply_filters( 'bbp_subscription_email_from', $from );
+		$from_string = empty( $from['name'] ) ? $from['address'] : "{$from['name']} <{$from['address']}>";
+		$from_string = apply_filters( 'bbp_subscription_from_email', $from_string ); // backwards compatibility
+		$this->headers []= "From: $from_string"; // array version $headers does not require proper line ending, see wp codex on wp_mail()
+		$this->headers = apply_filters( 'bbp_subscription_email_headers', $this->headers  );
+		$this->headers = apply_filters( 'bbp_subscription_mail_headers', $this->headers  ); // backwards compatiobility
+	}
+	
+	/**
+	 * WP Cron callback to send notification emails to subscribers
+	 */
+	public static function send( $notification ) {
+		do_action( 'bbp_pre_notify_subscribers' );
+	
+		add_action( 'phpmailer_init', array( 'BBP_Subscriber_Notification', 'set_bounce_address' ), 10, 1 );
+	
+		foreach ( $notification->recipients as $to ) {
+			$to_string = empty( $to['name'] ) ? $to['address'] : "{$to['name']} <{$to['address']}>";
+			wp_mail( $to_string, $notification->subject, $notification->message, $notification->headers );
+		}
+	
+		remove_action( 'phpmailer_init', array( 'BBP_Subscriber_Notification', 'set_bounce_address' ), 10, 1 );
+	
+		do_action( 'bbp_post_notify_subscribers' );
+	}
+	
+	/**
+	 * Sets PHPMailer::Sender to bounce address, configurable via filter
+	 * Invoke via 'phpmailer_init' action hook
+	 */
+	public static function set_bounce_address( $phpmailer ) {
+		$bounce_address = apply_filters( 'bbp_bounce_address', false );
+		$bounce_address = apply_filters( 'bbp_get_do_not_reply_address', false ); // backwards compatibility
+		if ( $bounce_address ) {
+			$phpmailer->Sender = $bounce_address;
+		}
+	}
+	
+	/**
+	 * Initializes recipients array from array of recipient user ids
+	 */
+	protected static function get_recipients( $user_ids ) {
+		if ( !$user_ids ) {
+			return apply_filters( 'bbp_subscription_email_recipients', array() );
+		}
+
+		global $wpdb;
+		$ids_substitution = substr( str_repeat( ',%d', count( $user_ids ) ), 1 );
+		$params = array_merge( array( "select user_email as address, display_name as name from {$wpdb->users} where ID in ($ids_substitution)" ), $user_ids );
+		$recipients = $wpdb->get_results( call_user_func_array( array( $wpdb, 'prepare' ), $params ), ARRAY_A );
+		if ( !is_array( $recipients ) ) {
+			$recipients = array();
+		}
+		
+		return apply_filters( 'bbp_subscription_email_recipients', $recipients );
+	}
+	
+	/**
+	 * Schedules a sending event with WP Cron
+	 */
+	protected static function schedule_wp_cron_event( $notification ) {
+		wp_schedule_single_event( time(), 'bbp_subscription_email_cron', array( $notification ) );
+	}
+}
+/**
+ * Forum subscription notification
+ *
+ * @package bbPress
+ * @subpackage Classes
+ *
+ * @since bbPress (r)
+ *
+ * @uses BBP_Subscriber_Notification
+ */
+class BBP_Forum_Subscriber_Notification extends BBP_Subscriber_Notification {
+
+	protected function __construct( $recipients, $forum_id, $topic_id ) {
+		parent::__construct( $recipients );
+	
+		// Remove filters from reply content and topic title to prevent content
+		// from being encoded with HTML entities, wrapped in paragraph tags, etc...
+		remove_all_filters( 'bbp_get_topic_content' );
+		remove_all_filters( 'bbp_get_topic_title'   );
+	
+		// collect various pieces of information
+		$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
+		$topic_title = strip_tags( bbp_get_topic_title( $topic_id ) );
+		$topic_author_display_name = bbp_get_topic_author_display_name( $topic_id );
+		$topic_url = get_permalink( $topic_id );
+		$topic_content = strip_tags( bbp_get_topic_content( $topic_id ) );
+		
+		// subject
+		$subject = sprintf( __( "[%s Forums] New topic: \"%s\"", 'bbpress' ), $blog_name, $topic_title );
+		$this->subject = apply_filters( 'bbp_forum_subscription_email_subject', $subject, $forum_id, $topic_id );
+		$this->subject = apply_filters( 'bbp_forum_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $topic_id, $forum_id, $user_id ); // backwards compatibility
+
+		// message
+		$message = sprintf( __( "%s wrote:\r\n\r\n%s\r\n\r\n\r\n-----------------------------------------\r\nRead this post online: %s\r\n\r\nIf you don't want to receive any more email notifications for this forum, please visit the above link and click \"Unsubscribe\" at the top of the page.", 'bbpress' ), $topic_author_display_name, $topic_content, $topic_url );
+		$this->message = apply_filters( 'bbp_forum_subscription_email_message', $message, $forum_id, $topic_id );
+		$this->message = apply_filters( 'bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id ); // backwards compatibility
+	}
+	
+	/**
+	 * Factory
+	 *
+	 * @return true on success, false on failure
+	 */
+	public static function schedule_sending( $forum_id, $topic_id ) {
+
+		// general checks and parameter validation
+		if ( !bbp_is_subscriptions_active() ||
+				!bbp_get_forum_id( $forum_id ) ||
+				!bbp_is_topic_published( $topic_id ) ) {
+			return false;
+		}
+		
+		// recipients
+		$user_ids = bbp_get_forum_subscribers( $forum_id, true );
+		$user_ids = array_diff( $user_ids, array( bbp_get_topic_author_id( $topic_id ) ) );
+		$user_ids = apply_filters( 'bbp_forum_subscription_user_ids', $user_ids );
+		$recipients = parent::get_recipients( $user_ids );
+		if ( !$recipients ) {
+			return false;
+		}
+		
+		$notification = new BBP_Forum_Subscriber_Notification( $recipients, $forum_id, $topic_id );
+		parent::schedule_wp_cron_event( $notification );
+		
+		return true;
+	}
+}
+/**
+ * Topic subscription notification
+ *
+ * @package bbPress
+ * @subpackage Classes
+ *
+ * @since bbPress (r)
+ *
+ * @uses BBP_Subscriber_Notification
+ */
+class BBP_Topic_Subscriber_Notification extends BBP_Subscriber_Notification {
+
+	protected function __construct( $recipients, $forum_id, $topic_id, $reply_id ) {
+		parent::__construct( $recipients );
+		
+		// Remove filters from reply content and topic title to prevent content
+		// from being encoded with HTML entities, wrapped in paragraph tags, etc...
+		remove_all_filters( 'bbp_get_reply_content' );
+		remove_all_filters( 'bbp_get_topic_title'   );
+		
+		// collect various pieces of information
+		$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
+		$topic_title = strip_tags( bbp_get_topic_title( $topic_id ) );
+		$reply_author_display_name = bbp_get_reply_author_display_name( $reply_id );
+		$reply_url = bbp_get_reply_url( $reply_id );
+		$reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );
+
+		// subject
+		$subject = sprintf( __( "[%s Forums] New reply to: \"%s\"", 'bbpress' ), $blog_name, $topic_title );
+		$this->subject = apply_filters( 'bbp_topic_subscription_email_subject', $subject, $forum_id, $topic_id, $reply_id );
+		$this->subject = apply_filters( 'bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id ); // backwards compatibility
+
+		// message
+		$message = sprintf( __( "%s replied:\r\n\r\n%s\r\n\r\n\r\n-----------------------------------------\r\nRead this post online: %s\r\n\r\nIf you don't want to receive any more email notifications for this topic, please visit the above link and click \"Unsubscribe\" at the top of the page.", 'bbpress' ), $reply_author_display_name, $reply_content, $reply_url );
+		$this->message = apply_filters( 'bbp_topic_subscription_email_message', $message, $forum_id, $topic_id, $reply_id );
+		$this->message = apply_filters( 'bbp_subscription_mail_message', $message, $reply_id, $topic_id ); // backwards compatibility
+	}
+	
+	/**
+	 * Factory
+	 *
+	 * @return true on success, false on failure
+	 */
+	public static function schedule_sending( $forum_id, $topic_id, $reply_id ) {
+		
+		// general checks and parameter validation
+		if ( !bbp_is_subscriptions_active() ||
+				!bbp_get_forum_id( $forum_id ) ||
+				!bbp_is_topic_published( $topic_id ) ||
+				!bbp_is_reply_published( $reply_id ) ) {
+			return false;
+		}
+				
+		// recipients
+		$user_ids = bbp_get_topic_subscribers( $topic_id, true );
+		$user_ids = array_diff( $user_ids, array( bbp_get_reply_author_id( $reply_id ) ) );
+		$user_ids = apply_filters( 'bbp_topic_subscription_user_ids', $user_ids );
+		$recipients = parent::get_recipients( $user_ids );
+		if ( !$recipients ) {
+			return false;
+		}
+		
+		$notification = new BBP_Topic_Subscriber_Notification( $recipients, $forum_id, $topic_id, $reply_id );
+		parent::schedule_wp_cron_event( $notification );
+		
+		return true;
+	}
+}
+endif; // class_exists check
Index: includes/common/functions.php
===================================================================
--- includes/common/functions.php	(revision 1220821)
+++ includes/common/functions.php	(working copy)
@@ -1001,208 +1001,11 @@
 /** Subscriptions *************************************************************/
 
 /**
- * Get the "Do Not Reply" email address to use when sending subscription emails.
- *
- * We make some educated guesses here based on the home URL. Filters are
- * available to customize this address further. In the future, we may consider
- * using `admin_email` instead, though this is not normally publicized.
- *
- * We use `$_SERVER['SERVER_NAME']` here to mimic similar functionality in
- * WordPress core. Previously, we used `get_home_url()` to use already validated
- * user input, but it was causing issues in some installations.
- *
- * @since bbPress (r5409)
- *
- * @see  wp_mail
- * @see  wp_notify_postauthor
- * @link https://bbpress.trac.wordpress.org/ticket/2618
- *
- * @return string
- */
-function bbp_get_do_not_reply_address() {
-	$sitename = strtolower( $_SERVER['SERVER_NAME'] );
-	if ( substr( $sitename, 0, 4 ) === 'www.' ) {
-		$sitename = substr( $sitename, 4 );
-	}
-	return apply_filters( 'bbp_get_do_not_reply_address', 'noreply@' . $sitename );
-}
-
-/**
- * Sends notification emails for new replies to subscribed topics
- *
- * Gets new post's ID and check if there are subscribed users to that topic, and
- * if there are, send notifications
- *
- * Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email
- * with everyone BCC'd. This may have negative repercussions for email services
- * that limit the number of addresses in a BCC field (often to around 500.) In
- * those cases, we recommend unhooking this function and creating your own
- * custom emailer script.
- *
- * @since bbPress (r5413)
- *
- * @param int $reply_id ID of the newly made reply
- * @param int $topic_id ID of the topic of the reply
- * @param int $forum_id ID of the forum of the reply
- * @param mixed $anonymous_data Array of anonymous user data
- * @param int $reply_author ID of the topic author ID
- *
- * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
- * @uses bbp_get_reply_id() To validate the reply ID
- * @uses bbp_get_topic_id() To validate the topic ID
- * @uses bbp_get_forum_id() To validate the forum ID
- * @uses bbp_get_reply() To get the reply
- * @uses bbp_is_reply_published() To make sure the reply is published
- * @uses bbp_get_topic_id() To validate the topic ID
- * @uses bbp_get_topic() To get the reply's topic
- * @uses bbp_is_topic_published() To make sure the topic is published
- * @uses bbp_get_reply_author_display_name() To get the reply author's display name
- * @uses do_action() Calls 'bbp_pre_notify_subscribers' with the reply id,
- *                    topic id and user id
- * @uses bbp_get_topic_subscribers() To get the topic subscribers
- * @uses apply_filters() Calls 'bbp_subscription_mail_message' with the
- *                    message, reply id, topic id and user id
- * @uses apply_filters() Calls 'bbp_subscription_mail_title' with the
- *                    topic title, reply id, topic id and user id
- * @uses apply_filters() Calls 'bbp_subscription_mail_headers'
- * @uses get_userdata() To get the user data
- * @uses wp_mail() To send the mail
- * @uses do_action() Calls 'bbp_post_notify_subscribers' with the reply id,
- *                    topic id and user id
- * @return bool True on success, false on failure
- */
-function bbp_notify_topic_subscribers( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0 ) {
-
-	// Bail if subscriptions are turned off
-	if ( ! bbp_is_subscriptions_active() ) {
-		return false;
-	}
-
-	/** Validation ************************************************************/
-
-	$reply_id = bbp_get_reply_id( $reply_id );
-	$topic_id = bbp_get_topic_id( $topic_id );
-	$forum_id = bbp_get_forum_id( $forum_id );
-
-	/** Topic *****************************************************************/
-
-	// Bail if topic is not published
-	if ( ! bbp_is_topic_published( $topic_id ) ) {
-		return false;
-	}
-
-	/** Reply *****************************************************************/
-
-	// Bail if reply is not published
-	if ( ! bbp_is_reply_published( $reply_id ) ) {
-		return false;
-	}
-
-	// Poster name
-	$reply_author_name = bbp_get_reply_author_display_name( $reply_id );
-
-	/** Mail ******************************************************************/
-
-	// Remove filters from reply content and topic title to prevent content
-	// from being encoded with HTML entities, wrapped in paragraph tags, etc...
-	remove_all_filters( 'bbp_get_reply_content' );
-	remove_all_filters( 'bbp_get_topic_title'   );
-
-	// Strip tags from text and setup mail data
-	$topic_title   = strip_tags( bbp_get_topic_title( $topic_id ) );
-	$reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );
-	$reply_url     = bbp_get_reply_url( $reply_id );
-	$blog_name     = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
-
-	// For plugins to filter messages per reply/topic/user
-	$message = sprintf( __( '%1$s wrote:
-
-%2$s
-
-Post Link: %3$s
-
------------
-
-You are receiving this email because you subscribed to a forum topic.
-
-Login and visit the topic to unsubscribe from these emails.', 'bbpress' ),
-
-		$reply_author_name,
-		$reply_content,
-		$reply_url
-	);
-
-	$message = apply_filters( 'bbp_subscription_mail_message', $message, $reply_id, $topic_id );
-	if ( empty( $message ) ) {
-		return;
-	}
-
-	// For plugins to filter titles per reply/topic/user
-	$subject = apply_filters( 'bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id );
-	if ( empty( $subject ) ) {
-		return;
-	}
-
-	/** Users *****************************************************************/
-
-	// Get the noreply@ address
-	$no_reply   = bbp_get_do_not_reply_address();
-
-	// Setup "From" email address
-	$from_email = apply_filters( 'bbp_subscription_from_email', $no_reply );
-
-	// Setup the From header
-	$headers = array( 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>' );
-
-	// Get topic subscribers and bail if empty
-	$user_ids = bbp_get_topic_subscribers( $topic_id, true );
-
-	// Dedicated filter to manipulate user ID's to send emails to
-	$user_ids = apply_filters( 'bbp_topic_subscription_user_ids', $user_ids );
-	if ( empty( $user_ids ) ) {
-		return false;
-	}
-
-	// Loop through users
-	foreach ( (array) $user_ids as $user_id ) {
-
-		// Don't send notifications to the person who made the post
-		if ( ! empty( $reply_author ) && (int) $user_id === (int) $reply_author ) {
-			continue;
-		}
-
-		// Get email address of subscribed user
-		$headers[] = 'Bcc: ' . get_userdata( $user_id )->user_email;
-	}
-
-	/** Send it ***************************************************************/
-
-	// Custom headers
-	$headers  = apply_filters( 'bbp_subscription_mail_headers', $headers  );
- 	$to_email = apply_filters( 'bbp_subscription_to_email',     $no_reply );
-
-	do_action( 'bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids );
-
-	// Send notification email
-	wp_mail( $to_email, $subject, $message, $headers );
-
-	do_action( 'bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids );
-
-	return true;
-}
-
-/**
  * Sends notification emails for new topics to subscribed forums
  *
  * Gets new post's ID and check if there are subscribed users to that forum, and
  * if there are, send notifications
  *
- * Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email
- * with everyone BCC'd. This may have negative repercussions for email services
- * that limit the number of addresses in a BCC field (often to around 500.) In
- * those cases, we recommend unhooking this function and creating your own
- * custom emailer script.
- *
  * @since bbPress (r5156)
  *
  * @param int $topic_id ID of the newly made reply
@@ -1211,141 +1014,13 @@
  * @param int $topic_author ID of the topic author ID
  *
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
- * @uses bbp_get_topic_id() To validate the topic ID
- * @uses bbp_get_forum_id() To validate the forum ID
  * @uses bbp_is_topic_published() To make sure the topic is published
- * @uses bbp_get_forum_subscribers() To get the forum subscribers
- * @uses bbp_get_topic_author_display_name() To get the topic author's display name
- * @uses do_action() Calls 'bbp_pre_notify_forum_subscribers' with the topic id,
- *                    forum id and user id
- * @uses apply_filters() Calls 'bbp_forum_subscription_mail_message' with the
- *                    message, topic id, forum id and user id
- * @uses apply_filters() Calls 'bbp_forum_subscription_mail_title' with the
- *                    topic title, topic id, forum id and user id
- * @uses apply_filters() Calls 'bbp_forum_subscription_mail_headers'
- * @uses get_userdata() To get the user data
- * @uses wp_mail() To send the mail
- * @uses do_action() Calls 'bbp_post_notify_forum_subscribers' with the topic,
- *                    id, forum id and user id
+ * @uses BBP_Topic_Subscriber_Notification to notify subscribers
+ *
  * @return bool True on success, false on failure
  */
 function bbp_notify_forum_subscribers( $topic_id = 0, $forum_id = 0, $anonymous_data = false, $topic_author = 0 ) {
-
-	// Bail if subscriptions are turned off
-	if ( ! bbp_is_subscriptions_active() ) {
-		return false;
-	}
-
-	/** Validation ************************************************************/
-
-	$topic_id = bbp_get_topic_id( $topic_id );
-	$forum_id = bbp_get_forum_id( $forum_id );
-
-	/**
-	 * Necessary for backwards compatibility
-	 *
-	 * @see https://bbpress.trac.wordpress.org/ticket/2620
-	 */
-	$user_id  = 0;
-
-	/** Topic *****************************************************************/
-
-	// Bail if topic is not published
-	if ( ! bbp_is_topic_published( $topic_id ) ) {
-		return false;
-	}
-
-	// Poster name
-	$topic_author_name = bbp_get_topic_author_display_name( $topic_id );
-
-	/** Mail ******************************************************************/
-
-	// Remove filters from reply content and topic title to prevent content
-	// from being encoded with HTML entities, wrapped in paragraph tags, etc...
-	remove_all_filters( 'bbp_get_topic_content' );
-	remove_all_filters( 'bbp_get_topic_title'   );
-
-	// Strip tags from text and setup mail data
-	$topic_title   = strip_tags( bbp_get_topic_title( $topic_id ) );
-	$topic_content = strip_tags( bbp_get_topic_content( $topic_id ) );
-	$topic_url     = get_permalink( $topic_id );
-	$blog_name     = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
-
-	// For plugins to filter messages per reply/topic/user
-	$message = sprintf( __( '%1$s wrote:
-
-%2$s
-
-Topic Link: %3$s
-
------------
-
-You are receiving this email because you subscribed to a forum.
-
-Login and visit the topic to unsubscribe from these emails.', 'bbpress' ),
-
-		$topic_author_name,
-		$topic_content,
-		$topic_url
-	);
-
-	$message = apply_filters( 'bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id );
-	if ( empty( $message ) ) {
-		return;
-	}
-
-	// For plugins to filter titles per reply/topic/user
-	$subject = apply_filters( 'bbp_forum_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $topic_id, $forum_id, $user_id );
-	if ( empty( $subject ) ) {
-		return;
-	}
-
-	/** User ******************************************************************/
-
-	// Get the noreply@ address
-	$no_reply   = bbp_get_do_not_reply_address();
-
-	// Setup "From" email address
-	$from_email = apply_filters( 'bbp_subscription_from_email', $no_reply );
-
-	// Setup the From header
-	$headers = array( 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>' );
-
-	// Get topic subscribers and bail if empty
-	$user_ids = bbp_get_forum_subscribers( $forum_id, true );
-
-	// Dedicated filter to manipulate user ID's to send emails to
-	$user_ids = apply_filters( 'bbp_forum_subscription_user_ids', $user_ids );
-	if ( empty( $user_ids ) ) {
-		return false;
-	}
-
-	// Loop through users
-	foreach ( (array) $user_ids as $user_id ) {
-
-		// Don't send notifications to the person who made the post
-		if ( ! empty( $topic_author ) && (int) $user_id === (int) $topic_author ) {
-			continue;
-		}
-
-		// Get email address of subscribed user
-		$headers[] = 'Bcc: ' . get_userdata( $user_id )->user_email;
-	}
-
-	/** Send it ***************************************************************/
-
-	// Custom headers
-	$headers  = apply_filters( 'bbp_subscription_mail_headers', $headers  );
-	$to_email = apply_filters( 'bbp_subscription_to_email',     $no_reply );
-
-	do_action( 'bbp_pre_notify_forum_subscribers', $topic_id, $forum_id, $user_ids );
-
-	// Send notification email
-	wp_mail( $to_email, $subject, $message, $headers );
-
-	do_action( 'bbp_post_notify_forum_subscribers', $topic_id, $forum_id, $user_ids );
-
-	return true;
+	return BBP_Forum_Subscriber_Notification::schedule_sending( $forum_id, $topic_id );
 }
 
 /**
@@ -1368,6 +1043,30 @@
 	return bbp_notify_topic_subscribers( $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author );
 }
 
+/**
+ * Sends notification emails for new replies to subscribed topics
+ *
+ * Gets new post's ID and check if there are subscribed users to that topic, and
+ * if there are, send notifications
+ *
+ * @since bbPress (r5413)
+ *
+ * @param int $reply_id ID of the newly made reply
+ * @param int $topic_id ID of the topic of the reply
+ * @param int $forum_id ID of the forum of the reply
+ * @param mixed $anonymous_data Array of anonymous user data
+ * @param int $reply_author ID of the topic author ID
+ *
+ * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
+ * @uses bbp_is_reply_published() To make sure the reply is published
+ * @uses BBP_Topic_Subscriber_Notification to notify subscribers
+ *
+ * @return bool True on success, false on failure
+ */
+function bbp_notify_topic_subscribers( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0 ) {
+	return BBP_Topic_Subscriber_Notification::schedule_sending( $forum_id, $topic_id, $reply_id );
+}
+
 /** Login *********************************************************************/
 
 /**
Index: includes/core/actions.php
===================================================================
--- includes/core/actions.php	(revision 1220821)
+++ includes/core/actions.php	(working copy)
@@ -224,13 +224,14 @@
 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_favorites' );
 
 // Subscriptions
-add_action( 'bbp_spam_topic',   'bbp_remove_topic_from_all_subscriptions'       );
-add_action( 'bbp_trash_topic',  'bbp_remove_topic_from_all_subscriptions'       );
-add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_subscriptions'       );
-add_action( 'bbp_trash_forum',  'bbp_remove_forum_from_all_subscriptions'       );
-add_action( 'bbp_delete_forum', 'bbp_remove_forum_from_all_subscriptions'       );
-add_action( 'bbp_new_reply',    'bbp_notify_subscribers',                 11, 5 );
-add_action( 'bbp_new_topic',    'bbp_notify_forum_subscribers',           11, 4 );
+add_action( 'bbp_subscription_email_cron', array( 'BBP_Subscriber_Notification', 'send' ), 10, 1 );
+add_action( 'bbp_spam_topic',              'bbp_remove_topic_from_all_subscriptions'             );
+add_action( 'bbp_trash_topic',             'bbp_remove_topic_from_all_subscriptions'             );
+add_action( 'bbp_delete_topic',            'bbp_remove_topic_from_all_subscriptions'             );
+add_action( 'bbp_trash_forum',             'bbp_remove_forum_from_all_subscriptions'             );
+add_action( 'bbp_delete_forum',            'bbp_remove_forum_from_all_subscriptions'             );
+add_action( 'bbp_new_reply',               'bbp_notify_subscribers',                       11, 5 );
+add_action( 'bbp_new_topic',               'bbp_notify_forum_subscribers',                 11, 4 );
 
 // Sticky
 add_action( 'bbp_spam_topic',   'bbp_unstick_topic' );
