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
344922
public function addme()
    {
        //control captcha
        $captcha = oxNew('oeCaptcha');
        if (!$captcha->passCaptcha(false)) {
            $this->_iPriceAlarmStatus = 2;

            return;
        }

        return parent::addme();
    }
1003059
public function validate()
    {
        if (count($this->_to) == 0
            && count($this->_cc) == 0
            && count($this->_bcc) == 0
        ) {
            return new SimpleEmailServiceError('Destination');
        }

        if (strlen($this->_source) == 0) {
            return new SimpleEmailServiceError('EmailSource');
        }

        if (strlen($this->_subject) == 0) {
            return new SimpleEmailServiceError('EmailSubject');
        }

        if (strlen($this->_body) == 0) {
            return new SimpleEmailServiceError('EmailBody');
        }
        return true;
    }
481358
protected function validateOrderCheckout()
    {
        if ($this->same_payment_address) {
            $this->unsetSubmitted('address.payment');
        }

        $this->setSubmitted('update', array());
        $this->setSubmitted('store_id', $this->store_id);
        $this->setSubmitted('user_id', $this->order_user_id);
        $this->setSubmitted('creator', $this->admin_user_id);

        if ($this->admin) {
            $this->setSubmitted('status', $this->order->getStatusInitial());
        }

        return $this->validateComponent('order');
    }
280863
public function verifyEmail()
    {
        $user = $this->_user;
        $user->status = User::STATUS_ACTIVE;
        return $user->save(false) ? $user : null;
    }
182864
protected function validateEmailExistsUser()
    {
        $field = 'email';
        $value = $this->getSubmitted($field);

        if ($this->isError($field) || !isset($value)) {
            return null;
        }

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

        if (empty($user['status'])) {
            $this->setErrorUnavailable($field, $this->translation->text('E-mail'));
            return false;
        }

        $this->setSubmitted($field, $user);
        return true;
    }
261527
protected function validatePaymentAddressOrder()
    {
        $field = 'payment_address';

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

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

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

        if (empty($value) && !$this->isError('shipping_address')) {
            $value = $this->getSubmitted('shipping_address');
        }

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

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

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

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

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

        $this->setSubmitted($field, $value);
        return true;
    }
110122
public function checkEmailChange()
    {
        // check if user didn't change email
        if ($this->email == $this->getOldAttribute("email")) {
            return false;
        }

        // check if we need to confirm email change
        if (!$this->module->emailChangeConfirmation) {
            return false;
        }

        // check if user is removing email address (only valid if Module::$requireEmail = false)
        if (!$this->email) {
            return false;
        }

        // update status and email before returning new email
        $newEmail = $this->email;
        $this->status = static::STATUS_UNCONFIRMED_EMAIL;
        $this->email = $this->getOldAttribute("email");
        return $newEmail;
    }
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();
    }
596895
public function validateEmail($email)
    {
        if (empty($email)) {
            return false;
        }

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

        return $validationViolationList->count() === 0;
    }
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;
    }
215133
public function save()
    {
        if ($this->validate()) {
            $this->user->scenario = 'settings';
            $this->user->username = $this->username;
            $this->user->nickname = $this->nickname;
            $this->user->password = $this->new_password;
            if ($this->email == $this->user->email && $this->user->unconfirmed_email != null) {
                $this->user->unconfirmed_email = null;
            } elseif ($this->email != $this->user->email) {
                switch ($this->getSetting('emailChangeStrategy')) {
                    case Settings::STRATEGY_INSECURE:
                        $this->insecureEmailChange();
                        break;
                    case Settings::STRATEGY_DEFAULT:
                        $this->defaultEmailChange();
                        break;
                    case Settings::STRATEGY_SECURE:
                        $this->secureEmailChange();
                        break;
                    default:
                        throw new \OutOfBoundsException('Invalid email changing strategy');
                }
            }
            return $this->user->save();
        }
        return false;
    }
1035263
public function PostSend() {
    $rtn = false;
    try {
      // Choose the mailer and send through it
      switch($this->Mailer) {
        case 'sendmail':
          $rtn = $this->SendmailSend($this->MIMEHeader, $this->MIMEBody);
          break;
        case 'smtp':
          $rtn = $this->SmtpSend($this->MIMEHeader, $this->MIMEBody);
          break;
        case 'mail':
          $rtn = $this->MailSend($this->MIMEHeader, $this->MIMEBody);
          break;
        default:
          $rtn = $this->MailSend($this->MIMEHeader, $this->MIMEBody);
          break;
      }

    } catch (phpmailerException $e) {
      $this->SetError($e->getMessage());
      if ($this->exceptions) {
        throw $e;
      }
      if ($this->SMTPDebug) {
        $this->edebug($e->getMessage()."\n");
      }
      return false;
    }
    return $rtn;
  }
236405
public function email(array $options) {
        if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_EMAIL)) {
            $this->elementData = filter_var($this->elementData, FILTER_SANITIZE_EMAIL);
            return true;
        }

        $this->addError($this->checkMessage('Invalid email adddress', $options));
        return false;
    }
368091
protected function checkPriceRange()
    {
        $isValid = true;

        $payPalPayment = $this->getPayment();

        if ($payPalPayment->oxpayments__oxfromamount->value != 0 ||
            $payPalPayment->oxpayments__oxtoamount->value != 0
        ) {
            $cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
            $price = $this->getPrice() / $cur->rate;

            $isValid = (($price >= $payPalPayment->oxpayments__oxfromamount->value) &&
                          ($price <= $payPalPayment->oxpayments__oxtoamount->value));
        }

        return $isValid;
    }
1155894
public function send()
    {
        $oxEMail = oxNew(\OxidEsales\Eshop\Core\Email::class);
        $blSend = $oxEMail->sendNewsletterMail($this, $this->_oUser, $this->oxnewsletter__oxsubject->value);

        return $blSend;
    }
390955
public function verifyEmailAction()
    {
        $userId = $this->params()->fromRoute('userId', null);
        $token = $this->params()->fromRoute('token', null);

        if ($userId === null || $token === null) {
            return $this->notFoundAction();
        }

        $user = $this->getUserMapper()->findById($userId);

        if (!$user) {
            return $this->notFoundAction();
        }

        if ($this->userRegistrationService->verifyEmail($user, $token)) {
            // email verified
            return $this->redirectToPostVerificationRoute();
        }

        // email not verified, probably invalid token
        $vm = new ViewModel();
        $vm->setTemplate('ht-user-registration/user-registration/verify-email-error.phtml');

        return $vm;

    }
272516
public function preSend()
    {
        try {
            $this->error_count = 0; // Reset errors
            $this->mailHeader = '';

            // Dequeue recipient and Reply-To addresses with IDN
            foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
                $params[1] = $this->punyencodeAddress($params[1]);
                call_user_func_array(array($this, 'addAnAddress'), $params);
            }
            if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
                throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
            }

            // Validate From, Sender, and ConfirmReadingTo addresses
            foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
                $this->$address_kind = trim($this->$address_kind);
                if (empty($this->$address_kind)) {
                    continue;
                }
                $this->$address_kind = $this->punyencodeAddress($this->$address_kind);
                if (!$this->validateAddress($this->$address_kind)) {
                    $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
                    $this->setError($error_message);
                    $this->edebug($error_message);
                    if ($this->exceptions) {
                        throw new phpmailerException($error_message);
                    }
                    return false;
                }
            }

            // Set whether the message is multipart/alternative
            if ($this->alternativeExists()) {
                $this->ContentType = 'multipart/alternative';
            }

            $this->setMessageType();
            // Refuse to send an empty message unless we are specifically allowing it
            if (!$this->AllowEmpty and empty($this->Body)) {
                throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
            }

            // Create body before headers in case body makes changes to headers (e.g. altering transfer encoding)
            $this->MIMEHeader = '';
            $this->MIMEBody = $this->createBody();
            // createBody may have added some headers, so retain them
            $tempheaders = $this->MIMEHeader;
            $this->MIMEHeader = $this->createHeader();
            $this->MIMEHeader .= $tempheaders;

            // To capture the complete message when using mail(), create
            // an extra header list which createHeader() doesn't fold in
            if ($this->Mailer == 'mail') {
                if (count($this->to) > 0) {
                    $this->mailHeader .= $this->addrAppend('To', $this->to);
                } else {
                    $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
                }
                $this->mailHeader .= $this->headerLine(
                    'Subject',
                    $this->encodeHeader($this->secureHeader(trim($this->Subject)))
                );
            }

            // Sign with DKIM if enabled
            if (!empty($this->DKIM_domain)
                && !empty($this->DKIM_selector)
                && (!empty($this->DKIM_private_string)
                   || (!empty($this->DKIM_private) && file_exists($this->DKIM_private))
                )
            ) {
                $header_dkim = $this->DKIM_Add(
                    $this->MIMEHeader . $this->mailHeader,
                    $this->encodeHeader($this->secureHeader($this->Subject)),
                    $this->MIMEBody
                );
                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
                    str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
            }
            return true;
        } catch (phpmailerException $exc) {
            $this->setError($exc->getMessage());
            if ($this->exceptions) {
                throw $exc;
            }
            return false;
        }
    }