Validates email
address. If email is wrong - returns false and exits. If email
address is OK - creates prcealarm object and saves it
(oxpricealarm::save()). Sends pricealarm notification mail
to shop owner.

@return  bool    false on error
771001
public function addme()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $myUtils = \OxidEsales\Eshop\Core\Registry::getUtils();

        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('pa');
        if (!isset($aParams['email']) || !oxNew(\OxidEsales\Eshop\Core\MailValidator::class)->isValidEmail($aParams['email'])) {
            $this->_iPriceAlarmStatus = 0;

            return;
        }

        $oCur = $myConfig->getActShopCurrencyObject();
        // convert currency to default
        $dPrice = $myUtils->currency2Float($aParams['price']);

        $oAlarm = oxNew(\OxidEsales\Eshop\Application\Model\PriceAlarm::class);
        $oAlarm->oxpricealarm__oxuserid = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getSession()->getVariable('usr'));
        $oAlarm->oxpricealarm__oxemail = new \OxidEsales\Eshop\Core\Field($aParams['email']);
        $oAlarm->oxpricealarm__oxartid = new \OxidEsales\Eshop\Core\Field($aParams['aid']);
        $oAlarm->oxpricealarm__oxprice = new \OxidEsales\Eshop\Core\Field($myUtils->fRound($dPrice, $oCur));
        $oAlarm->oxpricealarm__oxshopid = new \OxidEsales\Eshop\Core\Field($myConfig->getShopId());
        $oAlarm->oxpricealarm__oxcurrency = new \OxidEsales\Eshop\Core\Field($oCur->name);

        $oAlarm->oxpricealarm__oxlang = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());

        $oAlarm->save();

        // Send Email
        $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
        $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification($aParams, $oAlarm);
    }
1142551
public function isValid()
    {
        if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
            return false;
        }

        if (empty($this->userAgent)) {
            return false;
        }

        if (empty($this->series)) {
            return false;
        }

        if (empty($this->token)) {
            return false;
        }

        return true;
    }
264867
public function checkEmail() {
    if ($this->email === '') {
      return ['result' => true, 'message' => ''];
    }
    if (empty($this->email)) {
      return ['result' => false, 'message' => 'Please specify a valid email.'];
    }
    if (!preg_match(
        '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',
        $this->email
    )) {
      return [
        'result' => false,
        'message' => 'Email must be a correctly formatted address.'
      ];
    }
    $selector = ['&',
      'ilike' => [
        'email',
        str_replace(['\\', '%', '_'], ['\\\\\\\\', '\%', '\_'], $this->email)
      ]
    ];
    if (isset($this->guid)) {
      $selector['!guid'] = $this->guid;
    }
    $test = Nymph::getEntity(
        ['class' => '\Tilmeld\Entities\Group', 'skip_ac' => true],
        $selector
    );
    if (isset($test->guid)) {
      return [
        'result' => false,
        'message' => 'That email address is already registered.'
      ];
    }

    return [
      'result' => true,
      'message' => (
        isset($this->guid) ? 'Email is valid.' : 'Email address is valid!'
      )
    ];
  }
565265
public function validateEmailInactive()
    {
        // check for valid user
        $user = $this->getUser();
        if (!$user) {
            $this->addError("email", Yii::t("user", "Email not found"));
        } elseif ($user->status == $user::STATUS_ACTIVE) {
            $this->addError("email", Yii::t("user", "Email is already active"));
        } else {
            $this->user = $user;
        }
    }
897336
public function verifyEmail($requireVerifiedEmail = false)
    {
        if ($this->email_verified) {
            return true;
        }
        $this->email_verified = 1;
        if ($requireVerifiedEmail && !$this->is_active) {
            $this->is_active = 1;
        }

        return $this->save(false);
    }
1184821
public function validateEmailSender($email)
    {
        if (mb_strlen($email, 'UTF-8') > 255) {
            $this->addError(EmailConfigurationTransformer::EMAIL_SENDER, 'Sender email length has to be less or equal to 255');
            return false;
        }

        if (!empty($email)) {
            $emailValidator = new EmailValidator();
            if (!$emailValidator->isValid($email, new RFCValidation())) {
                $this->addError(EmailConfigurationTransformer::EMAIL_SENDER, 'Sender email must be an email address');
                return false;
            }
        }

        return true;
    }
596895
public function validateEmail($email)
    {
        if (empty($email)) {
            return false;
        }

        $validationViolationList = $this
            ->validator
            ->validate($email, new Email());

        return $validationViolationList->count() === 0;
    }
44890
public function validate()
    {
        $result = parent::validate();
        $checkEmail = [
            'EmailAddress' => 'EMAILADDRESSINVALID',
            'EmailFrom' => 'EMAILFROMINVALID',
            'EmailReplyTo' => 'EMAILREPLYTOINVALID',
        ];
        foreach ($checkEmail as $check => $translation) {
            if ($this->$check) {
                //may be a comma separated list of emails
                $addresses = explode(',', $this->$check);
                foreach ($addresses as $address) {
                    $trimAddress = trim($address);
                    if ($trimAddress && !Email::is_valid_address($trimAddress)) {
                        $error = _t(
                            __CLASS__.".$translation",
                            "Invalid email address $trimAddress"
                        );
                        $result->addError($error . " ($trimAddress)");
                    }
                }
            }
        }

        // if there is no from address and no fallback, you'll have errors if this isn't defined
        if (!$this->EmailFrom && empty(Email::getSendAllEmailsFrom()) && empty(Email::config()->get('admin_email'))) {
            $result->addError(_t(__CLASS__.".EMAILFROMREQUIRED", '"Email From" address is required'));
        }
        return $result;
    }
1262793
public function save()
    {
        parent::save();

        $soxId = $this->getEditObjectId();

        if (!$this->_allowAdminEdit($soxId)) {
            return false;
        }

        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");

        $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        if ($soxId != "-1") {
            $oUser->load($soxId);
        } else {
            $aParams['oxuser__oxid'] = null;
        }

        // checkbox handling
        $aParams['oxuser__oxactive'] = $oUser->oxuser__oxactive->value;

        $blNewsParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editnews");
        if (isset($blNewsParams)) {
            $oNewsSubscription = $oUser->getNewsSubscription();
            $oNewsSubscription->setOptInStatus((int) $blNewsParams);
            $oNewsSubscription->setOptInEmailStatus((int) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("emailfailed"));
        }

        $oUser->assign($aParams);
        $oUser->save();

        // set oxid if inserted
        $this->setEditObjectId($oUser->getId());
    }
341624
protected function validateUserIdAddress()
    {
        $field = 'user_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('User');

        if (empty($value) || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            return true; // Anonymous user
        }

        $user = $this->user->get($value);

        if (empty($user)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
761158
public function doValidate()
    {
        $isValid = false;
        $value = $this->valRaw();
        $regex = '/^'
            .'[a-z0-9_]+([_\.-][a-z0-9]+)*'     // user
            .'@'
            .'([a-z0-9]+([\.-][a-z0-9]+)*)+'    // domain
            .'(\.[a-z]{2,})'                    // sld, tld
            .'$/i';
        if (\preg_match($regex, $value, $matches)) {
            $this->debug->log('properly formatted');
            $isValid    = true;
            $hostname   = \strtolower($matches[2].$matches[4]);
            $ipaddress  = \gethostbyname($hostname);        // A record
            if ($ipaddress == '92.242.140.2') {
                // bogus
                $ipaddress = $hostname;
            }
            $this->debug->log('hostname', $hostname);
            $this->debug->log('ipaddress', $ipaddress);
            if ($ipaddress != $hostname) {
                $this->debug->log('A record', $ipaddress);
            } elseif ($mxrecord = \getmxrr($hostname, $mxhosts)) {
                $this->debug->log('getmxrr('.$hostname.')', $mxrecord);
            } elseif (\strpos($_SERVER['SERVER_NAME'], $hostname)) {
                $this->debug->log('email domain matches server domain');
            } else {
                $this->debug->warn('unable to verify email');
                $noticeName = $this->attribs['name'].'_notice';
                if (!isset($this->form->currentValues[$noticeName]) || $this->form->currentValues[$noticeName] != $value) {
                    $this->debug->warn('flagging');
                    $this->flag('We were unable to confirm this address.<br />Please confirm before continuing.');
                } else {
                    $this->debug->info('have seen notice');
                }
            }
        }
        $this->debug->log('isValid', $isValid);
        return $isValid;
    }
967633
public function validate()
    {
        $valid = true;
        $message = null;
        $type = $this->Type;

        // Check if empty strings
        switch ($type) {
            case 'URL':
            case 'Email':
            case 'Phone':
                if ($this->{$type} == '') {
                    $valid = false;
                    $message = _t(
                        __CLASS__ . '.VALIDATIONERROR_EMPTY'.strtoupper($type),
                        'You must enter a {TypeLabel}',
                        [
                            'TypeLabel' => $this->TypeLabel
                        ]
                    );
                }
                break;
            case 'File':
            case 'SiteTree':
                if ($type && empty($this->{$type.'ID'})) {
                    $valid = false;
                    $message = _t(
                        __CLASS__ . '.VALIDATIONERROR_OBJECT',
                        'Please select a {TypeLabel}',
                        [
                            'TypeLabel' => $this->TypeLabel
                        ]
                    );
                }
                break;
        }
        // if its already failed don't bother checking the rest
        if ($valid) {
            switch ($type) {
                case 'URL':
                    $allowedFirst = ['#', '/'];
                    if (!in_array(substr($this->URL, 0, 1), $allowedFirst) && !filter_var($this->URL, FILTER_VALIDATE_URL)) {
                        $valid = false;
                        $message = _t(
                            __CLASS__ . '.VALIDATIONERROR_VALIDURL',
                            'Please enter a valid URL.  Be sure to include http:// for an external URL. or begin your internal url/anchor with a "/" character'
                        );
                    }
                    break;
                case 'Email':
                    if (!filter_var($this->Email, FILTER_VALIDATE_EMAIL)) {
                        $valid = false;
                        $message = _t(
                            __CLASS__ . '.VALIDATIONERROR_VALIDEMAIL',
                            'Please enter a valid Email address'
                        );
                    }
                    break;
                case 'Phone':
                    if (!preg_match("/^\+?[0-9a-zA-Z\-\s]*[\,\#]?[0-9\-\s]*$/", $this->Phone)) {
                        $valid = false;
                        $message = _t(
                            __CLASS__ . '.VALIDATIONERROR_VALIDPHONE',
                            'Please enter a valid Phone number'
                        );
                    }
                    break;
            }
        }

        $result = ValidationResult::create();
        if (!$valid) {
            $result->addError($message);
        }

        $this->extend('updateValidate', $result);

        return $result;
    }
720463
private function hasEmail()
    {
        $email = $this->_scopeConfig->getValue('payment/pagseguro/email');

        // check for a e-mail
        if (!isset($email))
            return false;

        // check is the e-mail is valid
        if ($this->isValidEmail($email))
            return true;
        return false;
    }
210558
def is_valid_email(self):
        
        return bool(self.address and Email.re_email.match(self.address))
1321114
protected function validateComponentPricesOrder()
    {
        $field = 'data.components';
        $components = $this->getSubmitted($field);

        if (empty($components)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Price');

        if (!is_array($components)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        foreach ($components as $id => $component) {

            if (!is_numeric($component['price'])) {
                $this->setErrorNumeric("$field.$id", $label);
                continue;
            }

            if (strlen($component['price']) > 10) {
                $this->setErrorLengthRange("$field.$id", $label, 0, 10);
            }
        }

        return !$this->isError('components');
    }
859205
public function sendEmail()
    {
        
        $identityClass = \Yii::$app->user->identityClass;
        /* @var $user User */
        $user = $identityClass::findOne([
                    //  'status' => $identityClass::STATUS_ACTIVE,
                    'email' => $this->email,
        ]);

        if (!$user) {

            return false;
        }

        if (!$identityClass::isPasswordResetTokenValid($user->password_reset_token)) {

            $user->generatePasswordResetToken();
        }

        if (!$user->save()) {
     
            return false;
        }

        return Yii::$app
                        ->mailer
                        ->compose(
                                ['html' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-html', 'text' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-text'], ['user' => $user]
                        )
                        ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
                        ->setTo($this->email)
                        ->setSubject('Password ' . ($user->status != 0 ? 're' : '') . 'set for ' . Yii::$app->name)
                        ->send();
    }
980027
def validate_email(self, value):
        
        if EMAIL_CONFIRMATION:
            queryset = EmailAddress.objects.filter(email__iexact=value, verified=True)
        else:
            queryset = User.objects.get(email__iexact=value, is_active=True).count() == 0
        if queryset.count() < 1:
            raise serializers.ValidationError(_("Email address not found"))
        return queryset.first().email