@param $email
@param $websiteId

@return \Dotdigitalgroup\Email\Model\Contact
339226
public function getContactByEmail($email, $websiteId)
    {
        $contact = $this->contactFactory->create()
            ->loadByCustomerEmail($email, $websiteId);
        return $contact;
    }
771528
public function setEmail($email)
    {
        $email = (string) $email;

        if ($this->exists() && $this->email !== $email) {
            $this->updated['email'] = true;
        }

        $this->email = $email;

        return $this;
    }
419053
public function loadByCustomerEmail($email, $websiteId)
    {
        $collection = $this->addFieldToFilter('email', $email)
            ->addFieldToFilter('website_id', $websiteId)
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return false;
    }
429418
public function certonly($email, $webroot, $domains)
    {

        $result = $this->command . ' certonly --webroot --debug --agree-tos';
        $result .= ' --email ' . $email;
        $result .= ' -w ' . $webroot;

        foreach ($domains as $domain) {
            $result .= ' -d ' . $domain;
        }

        return $result;
    }
1153078
public function create($data, $websiteId = null)
    {
        if (isset($websiteId)) {
            return $this->client()->put($data, 'websites/{websiteId}', ['websiteId' => $websiteId]);
        }

        return $this->client()->post($data, 'websites');
    }
173377
public function getGoogleBatchServiceGmailForEmail(string $email)
    {
        if (array_key_exists($email, $this->googleBatchServiceGmails)) {
            return $this->googleBatchServiceGmails[$email];
        }

        $googleServiceGmail = new \Google_Service_Gmail($this->serviceAccount->getGoogleBatchClientForEmail($email));
        $this->googleBatchServiceGmails[$email] = $googleServiceGmail;

        return $googleServiceGmail;
    }
245169
public static function email($email)
    {
        $html = self::getInstance()->html;
        $args = func_get_args();
        return call_user_func_array(array($html, __FUNCTION__), $args);
    }
876733
public function getPushIntegrationCode($websiteID)
    {
        if (empty($websiteID)) {
            return $this->handleError('Empty website id');
        }

        $requestResult = $this->sendRequest('/push/websites/' . $websiteID . '/code');

        return $this->handleResult($requestResult);
    }
310802
public function getContactByEmail($email)
    {
        $url = $this->getApiEndpoint() . self::REST_CONTACTS . $email;
        $this->setUrl($url)
            ->setVerb('GET');

        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'GET CONTACT BY email : ' . $email . ' '
                . $response->message;
            $this->helper->debug('getContactByEmail', [$message]);
        }

        return $response;
    }
28589
public function setEmail($email)
    {
        $email = is_null($email) ? '' : $email;
        parent::setEmail($email);
        $this->setUsername($email);

        return $this;
    }
298743
public function set($websiteId, ConfigInterface $config)
    {
        $foundDifference = false;

        foreach ($config->getData() as $key => $value) {
            if ($config->setConfigValue($key, $value, $websiteId)) {
                $foundDifference = true;
            }
        }

        if ($foundDifference) {
            $config->cleanScope();
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
1318293
public function setDefault($websiteId)
    {
        /** @var ConfigInterface $config */
        $config = $this->configFactory->create();

        $foundDifference = false;

        foreach ($this->defaultConfig as $key => $value) {
            if ($config->setConfigValue($key, $value, $websiteId)) {
                $foundDifference = true;
            }
        }

        if ($foundDifference) {
            $config->cleanScope();
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
90381
private function createContact($apiClient, $customerEmail, $website, $contactFromTable)
    {
        $consentModel = $this->consentFactory->create();
        $consentData = $consentModel->getFormattedConsentDataByContactForApi(
            $website->getId(),
            $customerEmail
        );

        if (empty(! $consentData)) {
            $needToConfirm = $this->helper->getWebsiteConfig(
                \Magento\Newsletter\Model\Subscriber::XML_PATH_CONFIRMATION_FLAG,
                $website->getId()
            );
            $optInType = ($needToConfirm)? 'Double' : 'Single';
            $contactData = [
                'Email' => $customerEmail,
                'EmailType' => 'Html',
                'OptInType' => $optInType,
            ];

            $contact = $apiClient->postContactWithConsent(
                $contactData,
                $consentData
            );

        } else {
            $contact = $apiClient->postContacts(
                $customerEmail
            );
        }

        if (isset($contact->id)) {
            $contactFromTable->setContactId($contact->id);
            $this->helper->saveContact($contactFromTable);
        }

        return $contact;
    }
691025
public function setId(int $id): Email
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
109903
public function send($email)
    {
        $this->email = $email;
        $this->attachments = $email->getAttachments();

        $addresses = $this->addressManager->manageAddresses($this->email);

        $this->needsSpool = (count($addresses) > 1);

        if ($this->email->getIsTest()) {
            return $this->directSend($this->email->getTestAddressAsArray());
        }

        if ($this->needsSpool) {
            return $this->spoolSend($addresses);
        }

        return $this->directSend($addresses);
    }
279290
public function getContact($email, $websiteId, $contactFromTable = false)
    {
        if (! $this->isEnabled($websiteId)) {
            return false;
        }

        if ($contactFromTable) {
            $contact = $contactFromTable;
        } else {
            $contact = $this->contactFactory->create()
                ->loadByCustomerEmail($email, $websiteId);
        }

        $client = $this->getWebsiteApiClient($websiteId);
        $response = $client->getContactByEmail($email);
        if (! isset($response->id)) {
            $response = $client->postContacts($email);
        }

        if (isset($response->message)) {
            $contact->setEmailImported(1);
            if ($response->message == \Dotdigitalgroup\Email\Model\Apiconnector\Client::API_ERROR_CONTACT_SUPPRESSED) {
                $contact->setSuppressed(1);
            }
            $this->saveContact($contact);
            return false;
        }
        //save contact id
        if (isset($response->id)) {
            $contact->setContactId($response->id);
            $this->saveContact($contact);
        } else {
            //curl operation timeout
            return false;
        }

        return $response;
    }
499995
public function getByEmail(string $email)
	{
		return $this->setAuthorizer($this->getModel()->where('email', '=', $email)->first());
	}