You can check the email id for a specific website by using the below code.
<?php
namespace VendorModuelModel;
use MagentoCustomerApiAccountManagementInterface;
use MagentoStoreModelStoreManagerInterface;
class EmailExist {
/**
* @var AccountManagementInterface
*/
protected $customerManagement;
/**
* @var StoreManagerInterface
*/
protected $storeManager;
/**
* Data constructor.
*
* @param AccountManagementInterface $customerManagement
* @param StoreManagerInterface $storeManager
*/
public function __construct(
AccountManagementInterface $customerManagement,
StoreManagerInterface $storeManager
) {
$this->customerManagement = $customerManagement;
$this->storeManager = $storeManager;
}
/**
*
* @return bool
*/
public function emailExistOrNot(): bool
{
$email = "testemail@email.com";
$websiteId = (int)$this->storeManager->getWebsite()->getId();
$isEmailNotExists = $this->customerManagement->isEmailAvailable($email, $websiteId);
return $isEmailNotExists;
}
}
Hope this article will help you to check customer email id’s existance.

