suppress( $email, 'complaint' === $type || 'spam' === $type ? 'complaint' : 'bounced' ); return; } // Soft bounce — tolerate a few before giving up on the address. $key = 'mailpuff_sb_' . substr( Mailpuff_Schema::email_hash( $email ), 0, 32 ); $count = (int) get_transient( $key ) + 1; if ( $count >= self::SOFT_THRESHOLD ) { delete_transient( $key ); $this->suppress( $email, 'bounced' ); return; } set_transient( $key, $count, self::SOFT_TTL ); } /** * Suppress an address and reflect it on the subscriber row so the UI and * every recipient query exclude it going forward. * * @param string $email Recipient address. * @param string $reason Suppression reason ('bounced' | 'complaint'). */ private function suppress( $email, $reason ) { Mailpuff_Schema::suppress( $email, $reason ); $contact = Mailpuff_Contact::find_by_email( $email ); if ( $contact ) { Mailpuff_Contact::set_status( (int) $contact->id, 'complaint' === $reason ? Mailpuff_Schema::SUBSCRIBER_COMPLAINED : Mailpuff_Schema::SUBSCRIBER_BOUNCED ); } } }