How to get customer data by customer email in magento 2?

You can get customer information by just passing the customer email using below code snippet, Create Block file,

To Fetch Customer Data in Magento by customer email ID, you required a customer email id and an optional website id to fetch the correct data.

<?php
declare(strict_types=1);

namespace Rbj\Customer\Model;

use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;

class CustomerDetail
{
    public function __construct(CustomerRepositoryInterface $customerRepository )
    {
        $this->customerRepository = $customerRepository;
    }

    /**
     * @param string $email
     * @param ?int $websiteId
     * @return CustomerInterface
     * @throws LocalizedException
     */
    public function getCustomerByEmail(string $email, int $websiteId = null): CustomerInterface
    {
        try {
            $customer = $this->customerRepository->get($email, $websiteId);
        } catch (NoSuchEntityException $exception) {
            throw new LocalizedException(__('Provided Customer no longer exists.'));
        }
        
        return $customer;
    }
}

Call the getCustomerByEmail() function in the template file,

$customerEmail = 'roni_cost@example.com';
$websiteId = 1; // pass website id
 
$customer = $this->getCustomerByEmail($customerEmail,$websiteId);
echo $customer->getFirstname();
echo $customer->getEmail();
echo $customer->getLastname();

Get all customer data by the below way,
echo "<pre>"; print_r($customer->__toArray());

You might be interested Get customer data by customer id using the Customer data by ID link.