Get an HTML preview of a blast.
@param $blast_id
@param $email
@return array
@link http://docs.sailthru.com/api/preview
511676
public function previewBlastWithHTML($blast_id, $email) {
        $data = [ ];
        $data['blast_id'] = $blast_id;
        $data['email'] = $email;

        $result = $this->apiPost('preview', $data);
        return $result;
    }
559082
protected function generateHtml(BBcodeElementNodeInterface $el, $preview = false)
    {
        $children = $el->getChildren();
        $option = $el->getAttribute();
        if ($preview) {
            return $this->templating->render(
                'OpenOrchestraDisplayBundle::BBcode/link.html.twig',
                array(
                    'href' => '#',
                    'options' => html_entity_decode($option['link']),
                    'text' => $children[0]->getAsBBCode(),
                )
            );
        }
        $parameters = json_decode(html_entity_decode($option['link']), true);
        $uri = '#';
        try {
            $linkName = $this->nodeManager->getRouteDocumentName($parameters);
            try {
                $routeCompileParameters = array();
                if (array_key_exists('wildcard', $parameters)) {
                    foreach ($parameters['wildcard'] as $name => $value) {
                        $routeCompileParameters[$name] = urlencode($value);
                    }
                }
                $uri = $this->urlGenerator->generate($linkName, $routeCompileParameters, UrlGeneratorInterface::ABSOLUTE_PATH).(array_key_exists('query', $parameters) ? $parameters['query'] : '');
            } catch(RouteNotFoundException $e) {
            }
        } catch (NodeNotFoundException $e) {
        }

        return $this->templating->render(
            'OpenOrchestraDisplayBundle::BBcode/link.html.twig',
            array(
                'href' => $uri,
                'options' => '',
                'text' => $children[0]->getAsBBCode(),
            )
        );
    }
647193
public function previewTemplateWithHTML($template, $email) {
        $data = [ ];
        $data['template'] = $template;
        $data['email'] = $email;

        $result = $this->apiPost('preview', $data);
        return $result;
    }
1003326
def get_email_templates
      url = ApiRequest.base_path("questionpro.survey.getEmailTemplates")
      result = self.class.get(url, body: self.options)

      self.full_response = result
      self.status = result['status']
      
      email_templates = []
      result_email_templates = result['response']['emailTemplates']
      result_email_templates.each do |email_template|
        email_templates.push(EmailTemplate.new(email_template))
      end
      
      return email_templates
    end
290716
def send_preview(self, recipients, personalize="fallback"):
        """"""
        body = {
            "PreviewRecipients": [recipients] if isinstance(recipients, str) else recipients,
            "Personalize": personalize}
        response = self._post(self.uri_for("sendpreview"), json.dumps(body))
747924
public function previewTemplate(Template $template, $template_type)
		{
			$form_data = array(
				'template_name' => $template->getName(),
				'template_type' => $template_type
			);
			$data = $this->call('templatepreview', $form_data);

			return $data;
		}
549833
public function preview($id)
    {
        $item = app(StackRepository::class)->fetchOne((int) $id)->firstOrFail();

        if (in_array($item->notification->type->name, ['email', 'sms'])) {
            $classname    = $item->notification->type->name === 'email' ? EmailNotification::class : SmsNotification::class;
            $notification = app($classname);
            $notification->setModel($item);
            return view('antares/notifications::admin.logs.preview', ['content' => $notification->render()]);
        }

        $decorator = app(SidebarItemDecorator::class);
        $decorated = $decorator->item($item, config('antares/notifications::templates.notification'));
        return new JsonResponse(['content' => $decorated], 200);
    }
867188
public function previewRecurringBlastWithEmail($blast_repeat_id, $send_email) {
        $data = [ ];
        $data['blast_repeat_id'] = $blast_repeat_id;
        $data['send_email'] = $send_email;

        $result = $this->apiPost('preview', $data);
        return $result;
    }
226906
public function preview()
    {
        // Enable theme for preview (may be needed for Shortcodes)
        Config::nest();
        Config::modify()->set(SSViewer::class, 'theme_enabled', true);

        $content = $this->customise([
            'Body' => $this->record->getEmailBodyContent(),
            'HideFormData' => (bool) $this->record->HideFormData,
            'Fields' => $this->getPreviewFieldData()
        ])->renderWith($this->record->EmailTemplate);

        Config::unnest();

        return $content;
    }
808725
public function previewText($content = '', $userid = '', $type = 'openid')
    {
        $queryStr = [];

        if ($type == 'towxname') {
            $queryStr['towxname'] = $userid;
        } else {
            $queryStr['touser'] = $userid;
        }

        $queryStr['text']['content'] = $content;
        $queryStr['msgtype']         = 'text';

        $this->module = 'message';

        $res = $this->_post('mass/preview', $queryStr);

        return $res;
    }
1055557
public function preview($id)
    {
        $campagne = $this->campagne->find($id);
        $data     = $this->mailjet->getHtml($campagne->api_campagne_id);

        return response($data);
    }
519817
public static function checkForEmail($template, $email)
    {
        if (in_array($template, static::$safeTemplates)) {
            return [];
        }

        if (empty($email)) {
            return [];
        }

        if (!is_array($email)) {
            $email = [$email => null];
        }

        $emails = array_keys($email);

        return static::where(function($q) use ($template) {
                $q->where('template', $template)->orWhere('template', '*');
            })
            ->whereIn('email', $emails)
            ->lists('email');
    }
431431
private function get(string $email, string $listId): array
    {
        try {
            /** @var Collection $result */
            $result = $this->api->request(
                'lists/' . $listId . '/members/' . $this->getHashedEmail($email),
                array(),
                'get'
            );

            // will return the one and only member array('id', ...) from Collection
            return $result->all();
        } catch (\Exception $e) {
            return [];
        }
    }
911794
public function preview($entity, $id)
    {
        $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);

        if (!class_exists($modelString)) {
            $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity).'s';
        }

        $model = new $modelString();
        $modelInstance = $model->find($id);

        $data = [
            $entity => $modelInstance,
        ];

        if (config('app.locale') != config('cms.default-language', Cms::config('cms.default-language'))) {
            if ($modelInstance->translation(config('app.locale'))) {
                $data = [
                    $entity => $modelInstance->translation(config('app.locale'))->data,
                ];
            }
        }

        $view = 'cms-frontend::'.$entity.'.show';

        if (!View::exists($view)) {
            $view = 'cms-frontend::'.$entity.'s.show';
        }

        if ($entity === 'page') {
            $view = 'cms-frontend::pages.'.$modelInstance->template;
        }

        if ($entity === 'blog') {
            $view = 'cms-frontend::blog.'.$modelInstance->template;
        }

        return view($view, $data);
    }
331545
public function executeAction($preview = false)
    {
        $jobId = intval($this->getParam(\MUtil_Model::REQUEST_ID));

        $batch = $this->loader->getTaskRunnerBatch('commjob-execute-' . $jobId);
        $batch->setMessageLogFile($this->project->getCronLogfile());
        $batch->minimalStepDurationMs = 3000; // 3 seconds max before sending feedback

        if (!$batch->isLoaded() && !is_null(($jobId))) {
            $batch->addMessage(sprintf(
                    $this->_('Starting single %s mail job %s'),
                    $this->project->getName(),
                    $jobId
                    ));

            // Check for unprocessed tokens
            $tracker = $this->loader->getTracker();
            $tracker->loadCompletedTokensBatch($batch, null, $this->currentUser->getUserId());

            // We could skip this, but a check before starting the batch is better
            $sql = $this->db->select()->from('gems__comm_jobs', array('gcj_id_job'))
                    ->where('gcj_active > 0')
                    ->where('gcj_id_job = ?', $jobId);

            $job = $this->db->fetchOne($sql);

            if (!empty($job)) {
                $batch->addTask('Mail\\ExecuteMailJobTask', $job, null, null, $preview);
            } else {
                $batch->reset();
                $this->addMessage($this->_("Mailjob is inactive and won't be executed"), 'danger');
            }
            
            if ($preview === true) {
                $batch->autoStart = true;
            }
        }

        if ($batch->isFinished()) {
            // Add the messages to the view and forward
            $messages = $batch->getMessages(true);
            if (count($messages)) {
                $this->addMessage($messages, 'info');
            }

            $this->_reroute(array('action'=>'show'));
        }
        
        if ($preview === true) {
            $title = sprintf($this->_('Preview single mail job %s'), $jobId);
        } else {
            $title = sprintf($this->_('Executing single mail job %s'), $jobId);
        }

        $this->_helper->BatchRunner($batch, $title, $this->accesslog);
    }
127102
public function show($id)
    {
        $lists      = $this->mailjet->getAllLists();
        $newsletter = $this->newsletter->find($id);

        return view('newsletter::Backend.template.show')->with(['newsletter' => $newsletter, 'lists' => $lists]);
    }
1285969
public function previewAction($emailId, $lang)
    {
        $class = $this->container->getParameter('lexik_mailer.email_entity.class');
        $email = $this->get('doctrine.orm.entity_manager')->find($class, $emailId);

        if (!$email) {
            throw $this->createNotFoundException(sprintf('No email found for id "%d"', $emailId));
        }

        $preview = $this->get('lexik_mailer.message_preview_generator');
        $preview->getTemplatesPreview($email, $lang);

        return $this->render('LexikMailerBundle:Email:preview.html.twig', array_merge(array(
            'content'  => $preview->get('content'),
            'subject'  => $preview->get('subject'),
            'fromName' => $preview->get('fromName'),
            'errors'   => $preview->getErrors(),
        ), $this->getAdditionalParameters()));
    }