public function previewCampaign()
 {
     // get parameters from url route
     $parameters = $this->request->route()->parameters();
     // function to view online the campaign
     $emailCampaign = EmailCampaign::find(Crypt::decrypt($parameters['campaign']));
     // We check that the historyId exists and is equal to 0,
     // It is 0 when the request comes from a campaign preview
     if (isset($parameters['historyId']) && $parameters['historyId'] !== '0') {
         $emailSendHistorical = EmailSendHistory::builder()->where('id_048', Crypt::decrypt($parameters['historyId']))->first();
     }
     // if is a test mailing, set contactKey and historyId to 0
     $data = ['email' => isset($emailSendHistorical->email_041) ? $emailSendHistorical->email_041 : null, 'html' => $emailCampaign->header_044 . $emailCampaign->body_044 . $emailCampaign->footer_044, 'subject' => $emailCampaign->subject_044, 'campaign' => Crypt::encrypt($emailCampaign->id_044), 'contactKey' => isset($emailSendHistorical->id_041) ? Crypt::encrypt($emailSendHistorical->id_041) : '0', 'company' => isset($emailSendHistorical->company_041) ? $emailSendHistorical->company_041 : null, 'name' => isset($emailSendHistorical->name_041) ? $emailSendHistorical->name_041 : null, 'surname' => isset($emailSendHistorical->surname_041) ? $emailSendHistorical->surname_041 : null, 'birthDay' => isset($emailSendHistorical->birth_date_041) ? date(config('pulsar.datePattern'), $emailSendHistorical->birth_date_041) : null, 'historyId' => isset($parameters['historyId']) ? $parameters['historyId'] : '0'];
     $data = EmailServices::setTemplate($data);
     return view('pulsar::common.views.html_display', $data);
 }