-ҝWoΫ혙{׎5>7$ ЕWoΣs׎-h[EG+  a'RiÃ;|2&&pN*pN*pN@pNxpN0xpN11&pN*pN@*pN@pNxpN0xpN0<&pN*pN*pN@pNxpN0xpNG&pNS&pN-&pN_&pNk&pN&pN&pN&pNӦ&pN&pN&pN!&pN;&pNT&pNm&pN&pN3k^0Pbu1 4&pN@*pNpNpNpN3&pN`*pN(pNpNpNƨ&pNި&pN5-&pN*pNpNpNpN:&pNM&pN`&pNs&pN8 &pN*pN4pN0pN1pN7&pN@*pN4pN0pN1pN6%&pN*pN4pN0pN1pN1&pNK&pN_&pNs&pN&pN&pN&pN&pN&pN&pN &pN&pN+mT_2Kd} x -[gsUҾnRV= (2Gn :N ].|` چd,X 2 deS@u2*j^^-&pN )!pN@&!pN`&!pN:U&pN.!pN,!pN,!pN)!pN9`&pN.!pNp,!pNp,!pN)!pN;,&pN*pN(E!pNC!pNpC!pN@F!pN&pN&pN&pN&pNnxrZ7߷5h.LyƮg]<XQ'pN0M!pN0J!pN0J!pN G!pNk'pN *pNcT'pNHS'pN(pNe'pNcT'pN`!pN0!pN!pN@!pN!pN!pN]U'pNUU'pNi'pN*pN(pNf'pNс'pN,T'pNg'pN!pN0!pN@!pN!pN!pNp!pN!pN!pN!pNf'pNi'pNi'pN~'pN*pN|'pN{'pN}'pNe'pN|'pN"pN!pN@"pNp "pN!pN"pN!pN~'pN~'pN~'pN'pN` *pN'pN 'pN'pNe'pNtcode $body = (string)str_replace( '[lists_to_confirm]', join(', ', $segmentNames), $stringBody ); // replace activation link $body = (string)str_replace( [ 'http://[activation_link]', // See MAILPOET-5253 '[activation_link]', ], $this->subscriptionUrlFactory->getConfirmationUrl($subscriber), $body ); [ $html, $text, $subject, ] = Helpers::splitObject(Shortcodes::process($body, null, $newsletter, $subscriber, null)); return $this->buildEmailData($subject, $html, $text); } /** * @throws \Exception if unable to send the email. */ public function sendConfirmationEmail(SubscriberEntity $subscriber) { $signupConfirmation = $this->settings->get('signup_confirmation'); if ((bool)$signupConfirmation['enabled'] === false) { return false; } if (!$this->wp->isUserLoggedIn() && $subscriber->getConfirmationsCount() >= self::MAX_CONFIRMATION_EMAILS) { return false; } $authorizationEmailsValidation = $this->settings->get(AuthorizedEmailsController::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING); $unauthorizedSenderEmail = isset($authorizationEmailsValidation['invalid_sender_address']); if (Bridge::isMPSendingServiceEnabled() && $unauthorizedSenderEmail) { return false; } $segments = $subscriber->getSegments()->toArray(); $segmentNames = array_map(function(SegmentEntity $segment) { return $segment->getName(); }, $segments); $IsConfirmationEmailCustomizerEnabled = (bool)$this->settings->get(ConfirmationEmailCustomizer::SETTING_ENABLE_EMAIL_CUSTOMIZER, false); $email = $IsConfirmationEmailCustomizerEnabled ? $this->getMailBodyWithCustomizer($subscriber, $segmentNames) : $this->getMailBody($signupConfirmation, $subscriber, $segmentNames); // send email $extraParams = [ 'meta' => $this->mailerMetaInfo->getConfirmationMetaInfo($subscriber), ]; // Don't attempt to send confirmation email when sending is paused $confirmationEmailErrorMessage = __('There was an error when sending a confirmation email for your subscription. Please contact the website owner.', 'mailpoet'); if (MailerLog::isSendingPaused()) { throw new \Exception($confirmationEmailErrorMessage); } try { $defaultMailer = $this->mailerFactory->getDefaultMailer(); $result = $defaultMailer->send($email, $subscriber, $extraParams); } catch (\Exception $e) { MailerLog::processTransactionalEmailError(MailerError::OPERATION_CONNECT, $e->getMessage(), $e->getCode()); throw new \Exception($confirmationEmailErrorMessage); } if ($result['response'] === false) { if ($result['error'] instanceof MailerError && $result['error']->getLevel() === MailerError::LEVEL_HARD) { MailerLog::processTransactionalEmailError($result['error']->getOperation(), (string)$result['error']->getMessage()); } throw new \Exception($confirmationEmailErrorMessage); }; // E-mail was successfully sent we need to update the MailerLog MailerLog::incrementSentCount(); if (!$this->wp->isUserLoggedIn()) { $subscriber->setConfirmationsCount($subscriber->getConfirmationsCount() + 1); $this->subscribersRepository->persist($subscriber); $this->subscribersRepository->flush(); } $this->sentEmails[$subscriber->getId()] = true; return true; } }