Welcome Guest, Not a member yet? Register   Sign In
Issue with email->subject() function
#1

[eluser]Jevedor[/eluser]
I've used the email class many times before and never run into this issue, but for the particular site i am currently working on whenever I use the email->subject function it causes my email not to send. if i remove the function the email sends properly but throws an error on the page.... i am a bit perplexed.

here is the code... i removed the actual email addresses being used.

Code:
function form()
    {
        $this->form_validation->set_rules('first_name', 'First Name', "required");
        $this->form_validation->set_rules('last_name', 'Last Name', 'required');
        $this->form_validation->set_rules('address', 'Address', "required");
        $this->form_validation->set_rules('town', 'Town', "required");
        $this->form_validation->set_rules('zip', 'Zip Code', "required");
        $this->form_validation->set_rules('home_phone', 'Home Phone');
        $this->form_validation->set_rules('cell_phone', 'Cell Phone');
        $this->form_validation->set_rules('comments', 'Comments');
        
        if ($this->form_validation->run() == false) {

            $this->template->create_template(false,'getting_started/form');        
        
        } else {
        
            $post = $this->form_functions->clean_form($_POST);
                
            $this->email->from('[email protected]', $post['first_name'].' '.$post['last_name']);
            
            $this->email->to('[email protected]');
            $this->email->subject('Green Energy Helper Contact');
            
            $message = $post['first_name'].' '.$post['last_name'] . " Sent the following message from the greenenergyhelper.com contact form: \n\n";
    
            foreach ($post as $key => $value) {
                $message .= humanize($key).': '.$value."\n";
            }
            
            $this->email->message($message);
    
            $this->email->send();
            
            $this->template->create_template(false,'getting_started/submited');        
        }

}
#2

[eluser]TheFuzzy0ne[/eluser]
Are you getting any errors displayed in your log file?
#3

[eluser]Jevedor[/eluser]
No errors were generated in the log file.

but its okay, I got it working now.

I'm actually not sure what was causing the problem but I rewrote the section and it works now. Might have been some bizarre typo i missed just trickling down.
#4

[eluser]TheFuzzy0ne[/eluser]
Probably. It's always those little typos that have you spending hours trying to locate.




Theme © iAndrew 2016 - Forum software by © MyBB