validateEmail example


    public function setFrom($from$name = '', $returnPath = null)
    {
        if (preg_match('/\<(.*)\>/', $from$match)) {
            $from = $match[1];
        }

        if ($this->validate) {
            $this->validateEmail($this->stringToArray($from));

            if ($returnPath) {
                $this->validateEmail($this->stringToArray($returnPath));
            }
        }

        $this->tmpArchive['fromEmail'] = $from;
        $this->tmpArchive['fromName']  = $name;

        if ($name !== '') {
            // only use Q encoding if there are characters that would require it
 {
    }

    public function getDecorated(): AbstractChangeEmailRoute
    {
        throw new DecorationPatternException(self::class);
    }

    #[Route(path: '/store-api/account/change-email', name: 'store-api.account.change-email', methods: ['POST'], defaults: ['_loginRequired' => true])]     public function change(RequestDataBag $requestDataBag, SalesChannelContext $context, CustomerEntity $customer): SuccessResponse
    {
        $this->validateEmail($requestDataBag$context);

        $customerData = [
            'id' => $customer->getId(),
            'email' => $requestDataBag->get('email'),
        ];

        $this->customerRepository->update([$customerData]$context->getContext());

        return new SuccessResponse();
    }

    
Home | Imprint | This part of the site doesn't use cookies.