# suredonation/1.6.1/inc/import/charitable/email-suppressor.php

SureDonation – Donation Forms, Fundraising Campaigns &amp; Donor Management, version 1.6.1. 82 lines.

- Page: https://pluginprobe.com/plugins/suredonation/1.6.1/code/inc/import/charitable/email-suppressor.php
- Raw: https://pluginprobe.com/plugins/suredonation/1.6.1/raw/inc/import/charitable/email-suppressor.php
- Modified: 2026-09-09T06:00:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/suredonation/1.6.1/code/inc/import/charitable/email-suppressor.php#L10-L20`.

```php
<?php
/**
 * Email suppression for migration sessions.
 *
 * Activated for the duration of write-phase batches so the import does
 * not blast donation receipts or admin notifications to donors when
 * their historical records are inserted.
 *
 * @package SureDonation
 */

namespace SureDonation\Inc\Import\Charitable;

use SureDonation\Inc\Traits\Get_Instance;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * Email_Suppressor class.
 *
 * @since 1.0.0
 */
class Email_Suppressor {
	use Get_Instance;

	/**
	 * Whether suppression is currently engaged.
	 *
	 * @var bool
	 */
	private $active = false;

	/**
	 * Engage email suppression filters.
	 *
	 * Safe to call repeatedly; only adds the filters once.
	 *
	 * @return void
	 * @since  1.0.0
	 */
	public function activate() {
		if ( $this->active ) {
			return;
		}

		add_filter( 'suredonation_send_email', '__return_false', 999 );
		add_filter( 'suredonation_pro_send_email', '__return_false', 999 );

		$this->active = true;
	}

	/**
	 * Disengage email suppression filters.
	 *
	 * Safe to call repeatedly.
	 *
	 * @return void
	 * @since  1.0.0
	 */
	public function deactivate() {
		if ( ! $this->active ) {
			return;
		}

		remove_filter( 'suredonation_send_email', '__return_false', 999 );
		remove_filter( 'suredonation_pro_send_email', '__return_false', 999 );

		$this->active = false;
	}

	/**
	 * Whether suppression is engaged.
	 *
	 * @return bool
	 * @since  1.0.0
	 */
	public function is_active() {
		return $this->active;
	}
}

```
