First thing you need to do if you want to programmatically delete the customers, is identify a common pattern with the accounts (e.g emails all end in provider.ru
)
Next, you will want to backup your database in case anything goes wrong. And ideally, test this on a DEV/UAT site.
Following code examples are untested but should put you in the right direction, verify them yourself on a dev/uat environment and take proper backups beforehand.
SQL
After that, you can execute a select on the customer_entity
and confirm all the accounts are spam ones, then run a delete with the same conditions
SELECT * FROM customer_entity WHERE email LIKE '%provider.ru';
DELETE FROM customer_entity WHERE email LIKE '%provider.ru';
Mage 2 Script
A script version of the above would be something like the following, uploading into the root of the site and executing from cli with php tends to work best
<?php
ini_set('display_errors', 1);
ini_set('max_execution_time', 0);
ini_set("memory_limit", "-1");
set_time_limit(0);
error_reporting(E_ALL);
require './app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('admin');
$customerFactory = $objectManager->create(\Magento\Customer\Model\CustomerFactory::class);
$customers = $customerFactory->create()->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('email', array('like' => '%provider.ru'));
foreach ($customers as $customer) {
echo "Found Customer: {$customer->getId()} :: {$customer->getEmail()}",PHP_EOL;
// $customer->delete();
}