sendMail example

if ($optInNewsletter) {
                $hash = Random::getAlphanumericString(32);
                $data = serialize(['newsletter' => $email, 'subscribeToNewsletter' => true]);

                $link = $this->front->ensureRouter()->assemble([
                    'sViewport' => 'newsletter',
                    'action' => 'index',
                    'sConfirmation' => $hash,
                    'module' => 'frontend',
                ]);

                $this->sendMail($email, 'sOPTINNEWSLETTER', $link);

                $this->db->insert(
                    's_core_optin',
                    [
                        'datum' => new Zend_Date(),
                        'hash' => $hash,
                        'data' => $data,
                        'type' => 'swNewsletter',
                    ]
                );

                
// Completed - Garbage basket / temporary - order         $this->sDeleteTemporaryOrder();

        $this->db->executeUpdate(
            'DELETE FROM s_order_basket WHERE sessionID=?',
            [$this->getSession()->offsetGet('sessionId')]
        );

        $confirmMailDeliveryFailed = false;
        try {
            $this->sendMail($variables);
        } catch (Exception $e) {
            $confirmMailDeliveryFailed = true;
            $email = $this->sUserData['additional']['user']['email'];
            $this->logOrderMailException($e$orderNumber$email);
        }

        // Check if voucher is affected         $this->sTellFriend();

        if ($this->getSession()->offsetExists('sOrderVariables')) {
            $variables = $this->getSession()->offsetGet('sOrderVariables');
            
// redirect user if captcha is active and request is sent from the footer         if (strtolower($config->get('newsletterCaptcha')) !== 'nocaptcha'
            && $this->Request()->getPost('redirect') !== null
            && !($noCaptchaAfterLogin && Shopware()->Modules()->Admin()->sCheckUser())) {
            return;
        }

        if (empty($config->get('sOPTINNEWSLETTER')) || $this->View()->getAssign('voteConfirmed')) {
            $this->View()->assign('sStatus', Shopware()->Modules()->Admin()->sNewsletterSubscription(Shopware()->System()->_POST['newsletter']));
            if ($this->View()->getAssign('sStatus')['code'] == 3 && $this->View()->getAssign('sStatus')['isNewRegistration']) {
                // Send mail to subscriber                 $this->sendMail(Shopware()->System()->_POST['newsletter'], 'sNEWSLETTERCONFIRMATION');
            }
        } else {
            $this->View()->assign('sStatus', Shopware()->Modules()->Admin()->sNewsletterSubscription(Shopware()->System()->_POST['newsletter']));

            if ($this->View()->getAssign('sStatus')['code'] == 3) {
                if ($this->View()->getAssign('sStatus')['isNewRegistration']) {
                    Shopware()->Modules()->Admin()->sNewsletterSubscription(Shopware()->System()->_POST['newsletter'], true);
                    $hash = Random::getAlphanumericString(32);
                    $data = serialize(Shopware()->System()->_POST->toArray());

                    $link = $this->Front()->ensureRouter()->assemble(['sViewport' => 'newsletter', 'action' => 'index', 'sConfirmation' => $hash]);

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