Codeigniter error

Asked

Viewed 112 times

-1

Well, at the company’s developing INTRANET, I did a memo piece and simple Osti, but both are not working. They’re almost the same, follow code:

CANVAS

// Tela de envio de OSTI
            case 'enviar_osti':
                $CI =& get_instance();
                echo '<ol class="breadcrumb caminho">'.breadcrumb().'</ol>';
                echo form_open(current_url(), array('class'=>'form-padrao'));
                erros_validacao();
                get_msg('msgok');
                get_msg('msgerro');
                echo '<h4><img src="gl/glyphicons-87-display.png"> Ordem de Solicitação de TI</h4>';
                echo '<hr>';
                echo '<div class="form-group">';
                echo form_label('Título do problema:');
                echo form_input(array('name'=>'titulo', 'class'=>'form-control campo6', 'placeholder'=>'Digite o assunto da solicitação'), set_value('titulo'), 'autofocus');
                echo '</div>';  
                echo '<div class="form-group">';
                echo form_label('<i class="fa fa-comment-o"></i> Descrição do problema:'); echo '<i> [máx. de 520 caracteres]</i>';
                echo form_textarea(array('name'=>'des', 'class'=>'form-control campo6', 'placeholder'=>'Digite os detalhes da solicitação'), set_value('des'));
                echo '</div>';
                echo '<div class="form-group">';
                echo form_label('E-mail do solicitante:');
                echo form_input(array('name'=>'email', 'class'=>'form-control campo6', 'disabled'=>'disabled'), set_value('email', $CI->session->userdata('user_email')));
                echo '</div>';       
                echo '<hr>';
                echo anchor('home','<i class="fa fa-reply"></i> Voltar',array('class'=>'btn btn-primary btn-padrao'));          
                ?><button name="enviar_osti" class="btn btn-success btn-padrao" type="submit"><i class="fa fa-share"></i> Enviar</button><?php            
            echo form_close();      
            break;

FUNCTION

//====================  Envio de OSTI

    public function enviar_osti(){
        $CI =& get_instance();

        if (esta_logado()):
                $this->form_validation->set_message('max_length', 'O tamanho para o %s foi excedido!');
                $this->form_validation->set_rules('titulo','TITULO','required|ucwords');
                $this->form_validation->set_rules('des','DESCRIÇÃO','required|max_length[520]');
                $email = $CI->session->userdata('user_email');
                if($this->form_validation->run()==TRUE):
                    $titulo = $this->input->post('titulo');
                    $des = $this->input->post('des');
                    if ($this->sistema->enviar_email_osti($email, $titulo, $des)):
                        set_msg('msgok','OSTI enviada com sucesso!','sucesso');
                        redirect('servicos/enviar_osti');
                    else:
                        set_msg('msgerro','Erro ao enviar OSTI, contate o administrador','erro');
                        redirect('servicos/enviar_osti');
                    endif;

                endif;
                set_tema('conteudo', load_modulo('telas','enviar_osti'));
                load_template();

        else:
            load_template();

endif; }

//função de enviar email ao gerar OSTI
    public function enviar_email_osti($solicitante, $titulo, $mensagem, $formato='html'){
        $this->CI->load->library('email');
        $config['mailtype'] = $formato;
        $this->CI->email->initialize($config);
        $this->CI->email->from($solicitante);
        $this->CI->email->to('[email protected]');
        $this->CI->email->subject($titulo);
        $this->CI->email->message($mensagem);
        if ($this->CI->email->send()):
            return TRUE;
        else:
            return $this->CI->email->print_debugger();
        endif;

    }

Could you help me..

  • What is the error message? maybe the & be the problem.

  • 1

    then in fact it does not return error, it does right, of the message that was saved, but it is not sent in the email.... our purchase request part now also, it saved in the database, returns success message but the email part will not!

1 answer

0

Buddy, take a look because depending on the server’s SMPT settings, it won’t.. I had the same problem, I was able to fix using phpmailer with SMTP.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.