public function show($hashId)
 {
     $id = \Jamesy\Miscellaneous::decryptId($hashId);
     if ($email = Email::find($id)) {
     }
     return View::make('backend.emails.send_templates.main', ['email_body' => $email->email_body]);
 }
 public function destroy($id)
 {
     if ($email = Email::find($id)) {
         $email->is_deleted = 1;
         $email->save();
         return Response::json(['message' => 'Email deleted']);
     } else {
         return Response::json(['flash' => 'Server error'], 500);
     }
 }
 public function cadastroEmpresa()
 {
     try {
         $_POST = Utils::sanitazeArray($_POST);
         $rg = NULL;
         $tipoPessoa = $_POST[$this->Pessoa->name]['tipo_pessoa'];
         $nome = $_POST[$this->Pessoa->name]['nome'];
         $email = $_POST[$this->Pessoa->name]['email'];
         $razao = $_POST['Juridica']['razao'];
         $fantasia = $_POST['Juridica']['fantasia'];
         $ie = $_POST['Juridica']['ie'];
         $senha = Authentication::password($_POST[$this->Pessoa->name]['senha']);
         if ($tipoPessoa == 1) {
             $cpfCnpj = Utils::returnNumeric($_POST['Fisica']['cpf']);
             $_POST[$this->Pessoa->name]['cpf'] = Utils::returnNumeric($_POST['Fisica']['cpf']);
         } else {
             $this->Pessoa->validate = $this->Pessoa->validate_fisica;
             $cpfCnpj = Utils::returnNumeric($_POST['Juridica']['cnpj']);
             $_POST[$this->Pessoa->name]['cnpj'] = Utils::returnNumeric($_POST['Juridica']['cnpj']);
             $_POST[$this->Pessoa->name]['razao'] = $_POST['Juridica']['razao'];
             $_POST[$this->Pessoa->name]['fantasia'] = $_POST['Juridica']['fantasia'];
             $_POST[$this->Pessoa->name]['ie'] = $_POST['Juridica']['ie'];
         }
         $this->Pessoa->data = $_POST[$this->Pessoa->name];
         if ($this->Pessoa->validates()) {
             $retorno = $this->Pessoa->cadastroEmpresa($nome, $cpfCnpj, $rg, $razao, $fantasia, $ie, $email, $senha, $tipoPessoa);
             if (isset($retorno['pessoaId']) && $retorno['pessoaId'] > 0) {
                 //enviar email
                 #recupero a chave do usuario
                 $chave = $this->Pessoa->recuperaChave($cpfCnpj);
                 #recupero o corpo do meu email para ser cadastrado
                 $email = new Email();
                 $registro = $email->find('first', array('tag' => 'cadastro_sucesso'));
                 #faço a troca de siglas para personalizar o email
                 $array = array('__NOME_REMETENTE__' => $_POST[$this->Pessoa->name]['nome'], '__DATE__' => date('d/m/Y h:i:s'), '__URL__' => Router::url(array('Pages', 'ativarConta', $chave)));
                 #envio o email de confirmação para o meu cliente cadastrado
                 $objeto = new MailPHPMailer();
                 $objeto->setAssunto('Cadastro realizado com sucesso!');
                 $objeto->setRemetente();
                 $objeto->setDestinatario($_POST[$this->Pessoa->name]['email'], $_POST[$this->Pessoa->name]['nome']);
                 $objeto->setBody(str_replace(array_keys($array), array_values($array), $registro[0]['Email']['corpo_mail']));
                 $email = $objeto->sendMail();
                 #saida para o usuario
                 echo json_encode(array('erro' => false, 'mensagem' => "Seu cadastro foi efetuado com sucesso", 'pessoa_id' => (int) $retorno['pessoaId'], 'envio_email' => $email));
             } else {
                 #caso de erro fazer esse procedimento
             }
         } else {
             echo json_encode(array('erro' => true, 'erros' => $this->Pessoa->validateErros));
         }
     } catch (Exception $ex) {
         #em caso de erro fazer esse procedimento
         echo json_encode(array('erro' => true, 'erros' => utf8_encode($ex->getMessage())));
     }
 }
Esempio n. 4
0
 public function actionTracking($id)
 {
     header('Content-Type: image/jpg');
     if ($email = Email::find($id)) {
         $email->views++;
         $email->save();
     }
     $graphic_http = "http://{$_SERVER['HTTP_HOST']}/blank.jpg";
     $filesize = filesize('blank.jpg');
     header('Pragma: public');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Cache-Control: private', false);
     header('Content-Disposition: attachment; filename="blank.jpg"');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . $filesize);
     readfile($graphic_http);
     exit;
 }
Esempio n. 5
0
 public function agendadosEmail()
 {
     try {
         $agendados = $this->Cron->situacaoAgendadaEmail();
         $email = new Email();
         $email_body = $email->find('first', array('tag' => 'cron_email'));
         if (count($agendados) > 0) {
             foreach ($agendados as $registro) {
                 #condição para enviar emails
                 if ($registro['email'] != null || $registro['email'] != '') {
                     $this->eviarEmail($email_body, $registro);
                 }
             }
         }
         echo '<pre>';
         print_r($agendados);
     } catch (Exception $ex) {
         echo $ex->getMessage();
     }
 }
 public function envioEmail()
 {
     try {
         $this->layout = 'null';
         $token = $_GET['param'];
         $reserva = $this->Reserva->find('first', array('token' => $token));
         $reserva = array_shift($reserva);
         /**
          * recupero o salão e ambiente da reserva
          */
         $dadoEmailReserva = $this->Reserva->recuperaDadosReservaEmail($reserva['Reserva']['id']);
         $cliente = $this->Cliente->find('first', array('id' => $reserva['Reserva']['clientes_id']));
         /**
          * VERIFICO SE O CLIENTE TEM EMAIL CADASTRADO
          */
         if (!empty($dadoEmailReserva[0]['email']) && Session::read('Empresa.envio_sistema') == 1) {
             /**
              * envio o email para o cliente cadastrado para inserir na lista os dados das pessoas relacionadas
              */
             $email = new Email();
             $email->useTable = 'emails_sistema';
             if (in_array(Session::read('ContaEmpresa.contas_empresas_tipos_id'), array(1, 3, 5))) {
                 $registro = $email->find('first', array('tag' => 'email_confirmacao'));
             } else {
                 $registro = $email->find('first', array('tag' => 'email_confirmacao'));
             }
             /**
              * recupero o endereço da empresa
              */
             $endereco = $this->Endereco->findEnderecosEmpresa($this->empresas_id);
             $enderecoEmpresa = $endereco[0]['logradouro'] . ', ' . $endereco[0]['numero'] . ' | ' . $endereco[0]['cidade'] . ' - ' . $endereco[0]['bairro'] . ' - ' . $endereco[0]['uf'];
             /**
              * recupero as mesas
              */
             $mesaModel = new Mesa();
             $ambientesModel = new Ambiente();
             $mesas = $mesaModel->mesasReservas($reserva['Reserva']['id']);
             $ambientes = $ambientesModel->ambientesReservas($reserva['Reserva']['id']);
             /**
              * #faço a troca de siglas para personalizar o email
              */
             $dataMail = explode(' ', Utils::convertData($reserva['Reserva']['start']));
             $email->useTable = 'empresas_email_parametros';
             $email_parametros = $email->find('first', array('emails_sistema_id' => 5, 'empresas_id' => $this->empresas_id));
             $corpoEmailConfirmacao = $email->ajusteEmailConfirmacao($registro[0]['Email']['corpo_mail'], $email_parametros[0][$email->name]);
             $array = array('__CLIENTE__' => $cliente[0]['Cliente']['nome'], '__DATE__' => date('d/m/Y h:i:s'), '__NOME_FANTASIA__' => Session::read('Empresa.nome_fantasia'), '__CONVIDADOS__' => $reserva['Reserva']['qtde_pessoas'], '__LUGARES__' => $reserva['Reserva']['assentos'], '__ENDERECO_EMPRESA__' => $enderecoEmpresa, '__MESAS__' => join(' - ', array_values($mesas)), '__DATA_INICIO__' => $dataMail[0], '__HORAS_INICIO__' => $dataMail[1], '__SALAO__' => $dadoEmailReserva[0]['salao'], '__AMBIENTE__' => join(' - ', array_values($ambientes)), '__CAPACIDADE__' => $dadoEmailReserva[0]['capacidade'], '__URL_ATIVAR__' => Router::url(array('Reservas', 'confirmReservaEmail', $reserva['Reserva']['token'])));
             #envio o email de confirmação para o meu cliente cadastrado
             $objeto = new MailPHPMailer();
             $objeto->setAssunto('Confirmação : ' . Session::read('Empresa.nome_fantasia'));
             //$objeto->setRemetente();
             /**
              *   CORPO DO EMAIL
              */
             $corpoEmailConfirmacao = str_replace(array_keys($array), array_values($array), $corpoEmailConfirmacao);
             $objeto->setBody($corpoEmailConfirmacao);
             /**
              *   DESTINO PARA QUEM VAI O EMAIL - CLIENTE
              */
             $objeto->setDestinatario($dadoEmailReserva[0]['email'], $dadoEmailReserva[0]['cliente']);
             $emailEnvio = $objeto->sendMail();
             if ($emailEnvio) {
                 $gravaEmail = array('reservas_id' => $reserva['Reserva']['id'], 'empresas_id' => $reserva['Reserva']['empresas_id'], 'pessoas_id' => $this->pessoas_id, 'clientes_id' => $reserva['Reserva']['clientes_id'], 'created' => date('Y-m-d H:i:s'), 'status' => 1);
                 /**
                  * inserindo na tabela o envio do email
                  */
                 $this->Reserva->gravaEnvioEmail($gravaEmail);
                 echo json_encode(array('message' => 'Email enviado com sucesso!', "style" => 'success', 'time' => 5000, 'size' => 'sm', 'callback' => false, 'before' => "\$('#loading').fadeOut(500);", 'icon' => 'check', 'title' => 'Sucesso no envio!'));
             } else {
                 $gravaEmail = array('reservas_id' => $reserva['Reserva']['id'], 'empresas_id' => $reserva['Reserva']['empresas_id'], 'pessoas_id' => $this->pessoas_id, 'clientes_id' => $reserva['Reserva']['clientes_id'], 'created' => date('Y-m-d H:i:s'), 'status' => 0);
                 /**
                  * inserindo na tabela o envio do email
                  */
                 $this->Reserva->gravaEnvioEmail($gravaEmail);
                 echo json_encode(array('message' => 'Problema no servidor de envio dos emails, contate o suporte.', "style" => 'warning', 'time' => 5000, 'size' => 'sm', 'callback' => false, 'before' => "\$('#loading').fadeOut(500);", 'icon' => 'times', 'title' => 'Falha no envio!'));
             }
         } else {
             echo json_encode(array('message' => 'Não foi possivel reenviar seu email tente novamente mais tarde ou avise o suporte.', "style" => 'danger', 'time' => 5000, 'size' => 'sm', 'callback' => false, 'before' => false, 'icon' => 'times', 'title' => 'Falha no envio!'));
         }
     } catch (Exception $ex) {
         echo json_encode(array('message' => $ex->getMessage(), "style" => 'danger', 'time' => 5000, 'size' => 'sm', 'callback' => false, 'before' => false, 'icon' => 'times', 'title' => 'Falha no envio!'));
     }
 }
Esempio n. 7
0
 public function detail($id)
 {
     try {
         $email = Email::find($id);
         if (is_null($email)) {
             throw new Exception("This email could not be found.");
         }
         $data = Citrus::response('data', $email);
     } catch (Exception $e) {
         $data = Citrus::response('error', $e);
     }
     return $data;
 }
 public function move_to_sent($id)
 {
     $email = Email::find($id);
     $email->deleted = 0;
     $email->save();
     return Redirect::to('dashboard/emails?tab=sent');
 }
Esempio n. 9
0
            Route::get('dashboard/users/{id}/unban', 'UserController@un_ban');
            Route::get('dashboard/users/{id}/destroy', 'UserController@destroy');
            Route::group(['before' => 'csrf'], function () {
                Route::post('dashboard/users/store', 'UserController@store');
                Route::post('dashboard/users/update', 'UserController@update');
                Route::post('dashboard/users/bulk-destroy', 'UserController@bulk_destroy');
            });
        });
        Route::get('dashboard/logout', 'AuthenticationController@logout');
    });
    //Email Pages Frontend Stuff
    Route::get('email/{slug}/preview', 'FrontendController@preview');
    Route::get('email/{slug}', 'FrontendController@show');
    Route::get('email/show/{hashId}', function ($hashId) {
        $id = \Jamesy\Miscellaneous::decryptId($hashId);
        if ($email = Email::find($id)) {
        }
        return View::make('backend.emails.send_templates.view-in-browser', ['email_body' => $email->email_body]);
    });
    //Mailgun API Endpoint
    Route::post('VjwombzKYGxeAKLB', 'AnalyticController@delivered');
    Route::post('YlpnbJyeXGPORABk', 'AnalyticController@failed');
    Route::post('bQKgqoyPXyORMZeN', 'AnalyticController@opened');
    Route::post('EWOvPbGNPznDdJek', 'AnalyticController@clicked');
    Route::post('BLNlanrLvyAXgVkp', 'AnalyticController@bounced');
    Route::post('XxLMnpzjmyJDNPmZ', 'AnalyticController@complained');
    //Unsubscribe
    Route::get('unsubscribe/{id}', 'FrontendController@unsubscribe');
    //Etc
    Route::get('dashboard/pdf/test', 'SentEmailCustomController@test');
});
 public function destroy($id)
 {
     Email::find($id)->delete();
     return Response::json(['message' => 'Email deleted']);
 }
Esempio n. 11
0
 /**
  * @author FreelaPHP schuindt
  * @version 1.0
  * @todo metodo que realiza a recuperação de senha do usuario no banco de dados
  *
  * 
  * */
 public function recuperaSenha()
 {
     try {
         if (isset($_POST['email'])) {
             if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
                 $hash = Authentication::uuid();
                 if ($this->User->alteraHashSenha($_POST['email'], $hash)) {
                     $email = new Email();
                     $email->useTable = 'emails_sistema';
                     $registro = $email->find('first', array('tag' => 'recuperar_senha'));
                     #faço a troca de siglas para personalizar o email
                     $array = array('__EMAIL_REMETENTE__' => $_POST['email'], '__DATE__' => date('d/m/Y h:i:s'), '__URL__' => Router::url(array('Usuarios', 'resetarSenha', $hash)));
                     #envio o email de confirmação para o meu cliente cadastrado
                     $objeto = new MailPHPMailer();
                     $objeto->setAssunto('Reserva - Recuperar Senha!');
                     $objeto->setRemetente();
                     $objeto->setDestinatario($_POST['email'], 'Recuperar Senha');
                     $objeto->setBody(str_replace(array_keys($array), array_values($array), $registro[0]['Email']['corpo_mail']));
                     $objeto->sendMail();
                     $this->set('mensagem', 'Para alterar a senha clique no link enviado ao seu email');
                 } else {
                     $this->set('mensagem', 'Ocorreu algum erro no processo, tente novamente.');
                 }
             } else {
                 $this->set('mensagem', 'Email inválido');
             }
         }
         $this->set('title_layout', 'Esqueci minha senha');
         $this->render();
     } catch (Exception $ex) {
         echo $ex->getMessage();
     }
 }
Esempio n. 12
0
 function ItemModelId($path)
 {
     /* find pol, sol and the type of item */
     list($pol_id, $sol_id, $rest) = sscanf($path, "/opt/xplico/pol_%d/sol_%d/%s");
     $type = strtok($rest, '/');
     /* set sol id and pol id to avoid error permision in the controller */
     $this->Session->write('pol', $pol_id);
     $this->Session->write('sol', $sol_id);
     /* controller and id */
     $control = null;
     $id = null;
     switch ($type) {
         case 'http':
             /* load model */
             $Feed = new Feed_xml();
             /* find id */
             $control = 'Feed_xml';
             $conditions = array('Feed_xml.rs_body' => $path);
             $param = array('recursive' => 0, 'fields' => array('Feed_xml.id'), 'conditions' => $conditions);
             $id = $Feed->find('first', $param);
             if ($id == null) {
                 /* load model */
                 $Web = new Web();
                 /* find id */
                 $control = 'Web';
                 $conditions = array("or" => array('Web.rq_header' => $path, 'Web.rs_header' => $path, 'Web.rq_body' => $path, 'Web.rs_body' => $path));
                 $param = array('recursive' => 0, 'fields' => array('Web.id'), 'conditions' => $conditions);
                 $id = $Web->find('first', $param);
             }
             break;
         case 'fbwchat':
             /* load model */
             $Fbc = new Fbchat();
             /* find id */
             $control = 'Fbchat';
             $conditions = array('Fbchat.chat' => $path);
             $param = array('recursive' => 0, 'fields' => array('Fbchat.id'), 'conditions' => $conditions);
             $id = $Fbc->find('first', $param);
             break;
         case 'ftp':
             /* load model */
             $Ftp = new Ftp_file();
             /* find id */
             $control = 'Ftp_file';
             $conditions = array('Ftp_file.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Ftp_file.id'), 'conditions' => $conditions);
             $id = $Ftp->find('first', $param);
             if ($id == null) {
                 /* load model */
                 $Ftp = new Ftp();
                 /* find id */
                 $control = 'Ftp';
                 $conditions = array('Ftp.cmd_path' => $path);
                 $param = array('recursive' => 0, 'fields' => array('Ftp.id'), 'conditions' => $conditions);
                 $id = $Ftp->find('first', $param);
             }
             break;
         case 'ipp':
         case 'pjl':
             /* load model */
             $Pjl = new Pjl();
             /* find id */
             $control = 'Pjl';
             $conditions = array("or" => array('Pjl.pcl_path' => $path, 'Pjl.pdf_path' => $path));
             $param = array('recursive' => 0, 'fields' => array('Pjl.id'), 'conditions' => $conditions);
             $id = $Pjl->find('first', $param);
             break;
         case 'mail':
             /* load model */
             $Mail = new Email();
             /* find id */
             $control = 'Email';
             $conditions = array('Email.mime_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Email.id'), 'conditions' => $conditions);
             $id = $Mail->find('first', $param);
             break;
         case 'mms':
             /* load model */
             $Mms = new Mmscontent();
             /* find id */
             $control = 'Mmscontent';
             $conditions = array('Mmscontent.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Mmscontent.id'), 'conditions' => $conditions);
             $id = $Mms->find('first', $param);
             break;
         case 'nntp':
             /* load model */
             $Nntp = new Nntp_article();
             /* find id */
             $control = 'Nntp_article';
             $conditions = array('Nntp_article.mime_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Nntp_article.id'), 'conditions' => $conditions);
             $id = $Nntp->find('first', $param);
             break;
         case 'telnet':
             /* load model */
             $Teln = new Telnet();
             /* find id */
             $control = 'Telnet';
             $conditions = array('Telnet.cmd' => $path);
             $param = array('recursive' => 0, 'fields' => array('Telnet.id'), 'conditions' => $conditions);
             $id = $Teln->find('first', $param);
             break;
         case 'tftp':
             /* load model */
             $Tftp = new Tftp_file();
             $control = 'Tftp_file';
             $conditions = array('Tftp_file.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Tftp_file.id'), 'conditions' => $conditions);
             $id = $Tftp->find('first', $param);
             if ($id == null) {
                 /* load model */
                 $Tftp = new Tftp();
                 /* find id */
                 $control = 'Tftp';
                 $conditions = array('Tftp.cmd_path' => $path);
                 $param = array('recursive' => 0, 'fields' => array('Tftp.id'), 'conditions' => $conditions);
                 $id = $Tftp->find('first', $param);
             }
             break;
         case 'sip':
             /* load model */
             $mdl = new Sip();
             $control = 'sips';
             $conditions = array('Sip.commands' => $path);
             $param = array('recursive' => 0, 'fields' => array('Sip.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             if ($id == null) {
                 $conditions = array('Sip.ucaller' => $path);
                 $param = array('recursive' => 0, 'fields' => array('Sip.id'), 'conditions' => $conditions);
                 $id = $mdl->find('first', $param);
                 if ($id == null) {
                     $conditions = array('Sip.ucalled' => $path);
                     $param = array('recursive' => 0, 'fields' => array('Sip.id'), 'conditions' => $conditions);
                     $id = $mdl->find('first', $param);
                 }
             }
             break;
         case 'webmail':
             /* load model */
             $mdl = new Webmail();
             $control = 'webmails';
             $conditions = array('Webmail.mime_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Webmail.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'httpfile':
             /* load model */
             $mdl = new Httpfile();
             $control = 'httpfile';
             $conditions = array('Httpfile.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Httpfile.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'grbudp':
             /* load model */
             $mdl = new Unknow();
             $control = 'unknows';
             $conditions = array('Unknow.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'grbtcp':
             /* load model */
             $mdl = new Unknow();
             $control = 'unknows';
             $conditions = array('Unknow.file_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'rtp':
             /* load model */
             $mdl = new Rtp();
             $control = 'rtps';
             $conditions = array('Rtp.ucaller' => $path);
             $param = array('recursive' => 0, 'fields' => array('Rtp.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             if ($id == null) {
                 $conditions = array('Rtp.ucalled' => $path);
                 $param = array('recursive' => 0, 'fields' => array('Rtp.id'), 'conditions' => $conditions);
                 $id = $mdl->find('first', $param);
             }
             break;
         case 'irc':
             /* load model */
             $mdl = new Irc();
             $control = 'ircs';
             $conditions = array('Irc.cmd_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Irc.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             if ($id == null) {
                 /* load model */
                 $mdl = new Irc_channel();
                 $control = 'ircs';
                 $conditions = array('Irc_channel.channel_path' => $path);
                 $param = array('recursive' => 0, 'fields' => array('Irc_channel.id'), 'conditions' => $conditions);
                 $id = $mdl->find('first', $param);
             }
             break;
         case 'paltalk_exp':
             /* load model */
             $mdl = new Paltalk_exp();
             $control = 'paltalk_exps';
             $conditions = array('Paltalk_exp.channel_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Paltalk_exp.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'paltalk':
             /* load model */
             $mdl = new Paltalk_room();
             $control = 'paltalk_rooms';
             $conditions = array('Paltalk_room.room_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Paltalk_room.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
         case 'msn':
             /* load model */
             $mdl = new Msn_chat();
             $control = 'msn_chats';
             $conditions = array('Msn_chat.chat_path' => $path);
             $param = array('recursive' => 0, 'fields' => array('Msn_chat.id'), 'conditions' => $conditions);
             $id = $mdl->find('first', $param);
             break;
     }
     if ($id != null) {
         return array('model' => $control, 'id' => $id[$control]['id']);
     }
     return null;
 }
Esempio n. 13
0
 /**
  *    TRACK EMAIL OPENS
  **/
 public function track($id)
 {
     if (isset($id) && !empty($id)) {
         if (isset($_GET['email']) && !empty($_GET['email'])) {
             $email = Email::find($id);
             if ($email) {
                 if ($_GET['email'] == $email->to and $email->status != 'sucess' and $email->status != 'danger') {
                     $email->status = 'success';
                     // Aberto pelo destinatário
                     $email->last_open = $_GET['email'];
                     // Notificação de leitura de email
                     Notification::create(['icon' => 'fa-check', 'title' => $email->to . ' recebeu seu e-mail!<br/><small><span class="timeago" title="' . date('Y-m-d H:i:s') . '"></span></small>', 'status' => false]);
                 }
                 $email->save();
             } else {
                 return "Não encontrado";
             }
             //Full URI to the image
             $graphic_http = 'http://basaltosegranitos.com.br/img/blank.gif';
             //Get the filesize of the image for headers
             $filesize = filesize('img/blank.gif');
             //Now actually output the image requested (intentionally disregarding if the database was affected)
             header('Pragma: public');
             header('Expires: 0');
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Cache-Control: private', false);
             header('Content-Disposition: attachment; filename="blank.gif"');
             header('Content-Transfer-Encoding: binary');
             header('Content-Length: ' . $filesize);
             //Begin the header output
             //header( 'Content-Type: image/gif' );
             readfile($graphic_http);
         } else {
             return "Informe o e-mail";
         }
     } else {
         return "Informe o id";
     }
 }
 public function forward($id)
 {
     // Setting::forgetEmailSettingsCache($this->user);
     $email_configs = ['from_name' => Setting::getFromName($this->user), 'from_email' => Setting::getFromEmail($this->user), 'reply_to_email' => Setting::getReplyToEmail($this->user)];
     $tag_list = Tag::getTagList();
     $subscribers = Subscriber::getSubscribersForEmail();
     $subsArr = [];
     foreach ($subscribers as $subscriber) {
         $subsArr[$subscriber->email] = $subscriber->first_name . ' ' . $subscriber->last_name . '(' . $subscriber->email . ')';
     }
     $maillists = Maillist::getMaillistsForEmail();
     $listsArr = [];
     foreach ($maillists as $maillist) {
         $listsArr[$maillist->id] = $maillist->name . ' (' . count($maillist->subscribers) . ' subscribers)';
     }
     $email = Email::find($id);
     return View::make('backend.emails.edit', ['user' => $this->user, 'isAdmin' => $this->isAdmin, 'configs' => $this->configs, 'logged_in_for' => $this->logged_in_for, 'activeParent' => $this->activeParent, 'active' => 'createemails', 'subscribers' => $subsArr, 'mail_lists' => $listsArr, 'email_configs' => $email_configs, 'tag_list' => $tag_list, 'email' => $email]);
 }