Set email address.

@param String $email The email address

@return $this
431656
public function setEmail($email = '')
    {
        $email = (string)$email;

        // According to the docs, emails should be lowercase: https://en.gravatar.com/site/implement/hash/
        $email = trim($email);
        $email = strtolower($email);

        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new \InvalidArgumentException('Email should be a valid email address');
        }

        $this->email = md5($email);

        return $this;
    }
837784
public function setAuthorEmail($authorEmail)
    {
        $this->authorEmail
            = preg_match('/^' . self::REGEX_AUTHOR_EMAIL . '$/u', $authorEmail)
            ? $authorEmail : '';

        $this->content = null;
        return $this;
    }
1282651
public function requestEmailChange($email)
    {
        if ($email !== $this->email) {
            $this->raise(new EmailChangeRequested($this, $email));
        }

        return $this;
    }
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;
    }
962735
public function addTo($email, $name = null)
    {
        Argument::i()
            ->test(1, 'string')
            ->test(2, 'string', 'null');

        $this->to[$email] = $name;
        return $this;
    }
564586
public function setSender($email)
    {
        if ($this->isValidEmail($email) === true) {
            $this->sender = $email;
        } else {
            return false;
        }
    }
639380
public function addTo($email, $name='')
    {
        if (!is_array($email)) {
            $email = array($name => $email);
        }

        foreach ($email as $n => $recipient) {
            $this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
            $this->_to[] = $recipient;
        }

        return $this;
    }
109909
public function setTo($to)
    {
        if ($to instanceof Email) {
            $to = [$to];
        }

        foreach ($to as $email) {
            if (!$email instanceof Email) {
                throw new MailerException('Email must be an instance of \Webiny\Component\Mailer\Email.');
            }
            $this->addTo($email);
        }

        return $this;
    }
279445
public function setReplyTo($email)
    {
        if ($this->isValidEmail($email) === true) {
            $this->reply_to = $email;
        } else {
            return false;
        }
    }
1210972
public function setEmail($email)
    {
        if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $this->_options['email'] = $email;
            $this->_options['hash'] = strtolower(md5(trim($this->_options['email'])));
        } else {
            throw new \Exception('The email is in an invalid format!');
        }

        return $this;
    }
380041
public function to($emails)
    {
        if (is_array($emails)) {
            $this->to = $emails;
        } else {
            $this->to = (array) $emails;
        }

        return $this;
    }
345609
public function addTo(Email $email)
    {
        $this->to[] = $email;
        $this->message->addTo($email->email, $email->name);

        return $this;
    }
946691
public function sender($email, $name = null)
    {
        $email = $this->normalizeEmail($email);
        $this->getSwiftMessage()->setSender($email, $name);

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

        return $this->setEmail($sEmail);
    }
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;
    }
585794
public function setNotificationEmail($notificationEmail)
    {
        if (!empty($notificationEmail) && ctype_print($notificationEmail)) {
            $this->notificationEmail = trim($notificationEmail);
        }

        return $this;
    }
799642
public function setSender($email)
    {
        $mail = new Email($email);
        $parts = $mail->parse();

        $this->fromUser = $parts[0];
        $this->fromDomain = $parts[1];
    }