Build email from parts.

@param Email $email

@return Email
9798
public function build(Email $email): Email
    {
        foreach ($this->parts as $part) {
            $resolver = $this->registry->getResolverForPart($part);
            $resolver->addPart($email, $part);
        }

        $this->parts = [];

        return $email;
    }
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;
    }
305019
private function hostnameFromEmail($email)
    {
        $parts = explode('@', $email);

        if (count($parts) == 2) {
            return strtolower($parts[1]);
        }

        return null;
    }
228628
public function email($email)
    {
        if (! is_string($email) && ! is_array($email)) {
            throw new InvalidArgumentException('The email can be only string or array');
        }

        $this->emailTo = is_array($email) ? $email : [$email];

        // Force the job to run in foreground
        $this->inForeground();

        return $this;
    }
683783
public function send(Email $email)
    {
        if (!$this->connected()) {
            $this->_connect();
            $this->_auth();
        } else {
            $this->_smtpSend('RSET');
        }

        $this->_sendRcpt($email);
        $this->_sendData($email);

        if (!$this->_config['keepAlive']) {
            $this->_disconnect();
        }

        return $this->_content;
    }
289876
public function sendEmail($email)
    {
        return send_mail(
            'no-reply',
            get_app_name(),
            $email, $this->subject,
            $this->body,
            'html',
            '/contact/html',
            [
                'title' => 'This is title',
                'contact_name' => $this->name,
                'contact_email' => $this->email,
            ]
        );
    }
207591
public function setEmail($email): User
    {
        if ($this->email !== $email) {
            $this->email = $email;

            DB::table('user')
                ->where('user_id', '=', $this->user_id)
                ->update([
                    'email' => $email,
                ]);
        }

        return $this;
    }
949410
public function withUnverifiedEmail($email)
    {
        $request = clone $this;
        $request->email = $email instanceof Email ? $email : new Email($email);
        $request->emailIsVerified = false;

        return $request;
    }
1073280
public function getByEmail($email)
    {
        $filter = new IteratorFilter();
        $filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email));
        return $this->getUser($filter);
    }
881363
protected function parse_email($email)
        {
            $parts  = explode('@', $email);
            $domain = array_pop($parts);
            $user   = implode('@', $parts);
            return array($user, $domain);
        }
1036120
public static function oneByEmail($email)
	{
		if (!filter_var($email, FILTER_VALIDATE_EMAIL))
		{
			return self::oneByUsername($email);
		}

		return self::all()
			->whereEquals('email', $email)
			->row();
	}
918559
public static function protectEmail($email)
    {
        $chunks = explode('@', $email);
        $chunks[0] = substr($chunks[0], 0, 2) . '****';
        return implode('@', $chunks);
    }
1119956
public function send(Email $email) {
		if (!empty($this->_config['queue'])) {
			$this->_config = $this->_config['queue'] + $this->_config;
			$email->setConfig((array)$this->_config['queue'] + ['queue' => []]);
			unset($this->_config['queue']);
		}

		$transport = $this->_config['transport'];
		$email->setTransport($transport);

		/** @var \Queue\Model\Table\QueuedJobsTable $QueuedJobs */
		$QueuedJobs = TableRegistry::getTableLocator()->get('Queue.QueuedJobs');
		$result = $QueuedJobs->createJob('Email', ['transport' => $transport, 'settings' => $email]);
		$result['headers'] = '';
		$result['message'] = '';

		return $result->toArray();
	}
589939
public function from(string $email, string $name = null)
    {
        $this->mailer->setFrom($email, $name ?? '');
        return $this;
    }
483134
public function send(\SendGrid\Mail\Mail $email)
    {
        return $this->client->mail()->send()->post($email);
    }
565072
protected function encodeEmail($email)
    {
        if ($email == '')
        {
            return '';
        }
        if (strpos($email, '@') === false)
        {
            return $email; // see #6241
        }
        $arrChunks = explode('@', $email);
        $strHost = array_pop($arrChunks);
        return implode('@', $arrChunks) . '@' . static::encode($strHost);
    }
1038747
protected function generateMessage($email, $message)
    {
        foreach ($message->getToWithCarriers() as $number) {
            $email->to($this->buildEmail($number, $message));
        }

        if ($message->getAttachImages()) {
            foreach ($message->getAttachImages() as $image) {
                $email->attach($image);
            }
        }

        $email->from($message->getFrom());

        return $email;
    }