Send email.

@param \Cake\Mailer\Email $email Email instance.

@return array|bool
352795
public function send(Email $email)
    {
        $result = $this->execute('emailWithWorker', [
            'email' => $email,
            'transport' => $this->config('transport'),
            'fullBaseUrl' => Configure::read('App.fullBaseUrl'),
        ], $this->config('background'));

        if (!$this->config('background')) {
            return $result;
        }

        return true;
    }
738300
public function send()
    {
        $this->logger->debug(
            'Attempting to send an email',
            $this->to()
        );

        $mail = $this->phpMailer;

        try {
            $this->setSmtpOptions($mail);

            $mail->CharSet = 'UTF-8';

            // Setting reply-to field, if required.
            $replyTo = $this->replyTo();
            if ($replyTo) {
                $replyArr = $this->emailToArray($replyTo);
                $mail->addReplyTo($replyArr['email'], $replyArr['name']);
            }

            // Setting from (sender) field.
            $from = $this->from();
            $fromArr = $this->emailToArray($from);
            $mail->setFrom($fromArr['email'], $fromArr['name']);

            // Setting to (recipients) field(s).
            $to = $this->to();
            foreach ($to as $recipient) {
                $toArr = $this->emailToArray($recipient);
                $mail->addAddress($toArr['email'], $toArr['name']);
            }

            // Setting cc (carbon-copy) field(s).
            $cc = $this->cc();
            foreach ($cc as $ccRecipient) {
                $ccArr = $this->emailToArray($ccRecipient);
                $mail->addCC($ccArr['email'], $ccArr['name']);
            }

            // Setting bcc (black-carbon-copy) field(s).
            $bcc = $this->bcc();
            foreach ($bcc as $bccRecipient) {
                $bccArr = $this->emailToArray($bccRecipient);
                $mail->addBCC($bccArr['email'], $bccArr['name']);
            }

            // Setting attachment(s), if required.
            $attachments = $this->attachments();
            foreach ($attachments as $att) {
                $mail->addAttachment($att);
            }

            $mail->isHTML(true);

            $mail->Subject = $this->subject();
            $mail->Body    = $this->msgHtml();
            $mail->AltBody = $this->msgTxt();

            $ret = $mail->send();

            $this->logSend($ret, $mail);

            return $ret;
        } catch (Exception $e) {
            $this->logger->error(
                sprintf('Error sending email: %s', $e->getMessage())
            );
        }
    }
499995
public function getByEmail(string $email)
	{
		return $this->setAuthorizer($this->getModel()->where('email', '=', $email)->first());
	}
268461
private function validateEmail($email) {

		if(true === is_string($email)) {
			return false !== filter_var(trim($email), \FILTER_VALIDATE_EMAIL);
		}

		return false;
	}
1292525
public function email($sEmail = null)
    {
        if (null === $sEmail) {
            return $this->getEmail();
        }

        return $this->setEmail($sEmail);
    }
742171
public function validateEmail($email)
    {
        $person = $this->getService('repos:people.person')->find(array('email' => $email));

        if ($person) {
            $this->setMessage('Email is already in use');
            return false;
        }

        return true;
    }
464224
public static function getByEmail($email)
    {
        $fields = self::getDbConnection()->fetchAssoc('SELECT * FROM '.User::TABLE.' WHERE email = ?', array($email));
        if (!$fields) return false;
        return self::fetch($fields);       
  	}
699800
public function set_sender($email)
        {
            $parts = $this->parse_email($email);
            $this->from_user = $parts[0];
            $this->from_domain = $parts[1];
        }
101196
public function isEmailBanned($email)
    {
        $emailTemplates = $this->getEmailTemplates();

        foreach ($emailTemplates as $emailTemplate) {
            $emailRule = new Email($emailTemplate);
            if ($emailRule->check($email)) {
                return true;
            }
        }
        return false;
    }
695716
public function setEmail($email)
    {
        $email = trim($email);

        if (preg_match('/\<(.*)\>/', $email, $matches)) {
            $email = trim(str_replace($matches[ 0 ], '', $email));
            $name = $matches[ 1 ];
        }

        if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $this->email = $email;

            if (isset($name)) {
                $this->setName($name);
            }
        }

        return $this;
    }
277045
public static function CheckEmail($email){
		   if(preg_match("/^[\-\!\#\$\%\&\'\*\+\.\/0-9\=\?A-Z\^\_\`a-z\{\|\}\~]+\@([\-\!\#\$\%\&\'\*\+\/0-9\=\?A-Z\^\_\`a-z\{\|\}\~]+\.)+[a-zA-Z]{2,6}$/", $email)){
		   	  $var=explode("@",$email);
		   	  $var=array_pop($var);
		      if(checkdnsrr($var,"MX")){return true;}else{return false;}
		   }else{
		      return false;
		   }
		}
1071313
public function existsByEmail ($email)
    {
        $entity = $this->er->findOneBy(array('email' => $email));

        if (NULL == $entity) {
            return false;
        } else {
            return true;
        }
    }
1102489
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']);
		}

		$settings = [
			'from' => [$email->getFrom()],
			'to' => [$email->getTo()],
			'cc' => [$email->getCc()],
			'bcc' => [$email->getBcc()],
			'charset' => [$email->getCharset()],
			'replyTo' => [$email->getReplyTo()],
			'readReceipt' => [$email->getReadReceipt()],
			'returnPath' => [$email->getReturnPath()],
			'messageId' => [$email->getMessageId()],
			'domain' => [$email->getDomain()],
			'headers' => [$email->getHeaders()],
			'headerCharset' => [$email->getHeaderCharset()],
			'theme' => [$email->getTheme()],
			'profile' => [$email->getProfile()],
			'emailFormat' => [$email->getEmailFormat()],
			'subject' => method_exists($email, 'getOriginalSubject') ? [$email->getOriginalSubject()] : [$email->getSubject()],
			'transport' => [$this->_config['transport']],
			'attachments' => [$email->getAttachments()],
			'template' => [$email->getTemplate()],
			'layout' => [$email->getLayout()],
			'viewVars' => [$email->getViewVars()]
		];

		foreach ($settings as $setting => $value) {
			if (array_key_exists(0, $value) && ($value[0] === null || $value[0] === [])) {
				unset($settings[$setting]);
			}
		}

		$QueuedJobs = $this->getQueuedJobsModel();
		$result = $QueuedJobs->createJob('Email', ['settings' => $settings]);
		$result['headers'] = '';
		$result['message'] = '';

		return $result->toArray();
	}
377101
public function send()
    {

        if ($this->Logger->isEnabled()) {
            if($this->mailer->IsError())
                $this->Logger->debug("ERROR OCCURRED");

            $this->Logger->debug("Headers:\n".$this->mailer->CreateHeader());
            $this->Logger->debug("Body:\n".$this->mailer->CreateBody());
        }

        if (!$this->testingOnly) {
            try {
                $this->mailer->Send();
            } catch (phpmailerException $e) {
                throw new EmailException($e->getMessage(), $e->getCode());
            }

        }
        return true;
    }
414827
public function setTo($email)
    {
        if (is_string($email)) {
            $email = [ $email ];
        }

        if (!is_array($email)) {
            throw new InvalidArgumentException(
                'Must be an array of recipients.'
            );
        }

        $this->to = [];

        // At this point, `$email` can be an _email array_ or an _array of emails_...
        if (isset($email['email'])) {
            // Means we're not dealing with multiple emails
            $this->addTo($email);
        } else {
            foreach ($email as $recipient) {
                $this->addTo($recipient);
            }
        }

        return $this;
    }
1260433
public function isEmailUnique($email)
    {
        $this->find("email", $email);
        if (isset($this->id)) {
            return false;
        }
        return true;
    }
771528
public function setEmail($email)
    {
        $email = (string) $email;

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

        $this->email = $email;

        return $this;
    }