how to load customer by email in magento2?
In Magento 2 you need to use the get
method from the Magento\Customer\Api\CustomerRepositoryInterface
service contract class.
public function get($email, $websiteId = null);
It is working fine, please use below code-
$CustomerModel = $objectManager->create('Magento\Customer\Model\Customer');
$CustomerModel->setWebsiteId(1); **//Here 1 means Store ID**
$CustomerModel->loadByEmail($customerEmail);
$userId = $CustomerModel->getId();