We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

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.

Fill the below form if you need any Magento relate help/advise/consulting.

With Only Agency that provides a 24/7 emergency support.

    Recent Articles
    Get a Free Quote

      Full Name

      Email Address

      Mobile Number

      Message

      Let’s initiate a discussion!!

      With Only Agency that provides a 24/7 emergency support.

        Full Name

        Email Address

        Mobile Number

        Message