Welcome Guest, Not a member yet? Register   Sign In
What's Wrong WIth My Email Class?
#1

[eluser]ShoeLace1291[/eluser]
Code:
function index(){
    
        $this->template->head($title = 'New Member Registration', FALSE);
        
        $this->load->helper('form');
        
        $this->load->library('form_validation');
        
        $this->form_validation->set_error_delimiters('<li>', '</li>');
        $this->form_validation->set_rules('emailAddress', 'Email', 'required|valid_email|callback_available_email');
        $this->form_validation->set_rules('displayName', 'Display Name', 'required|min_length[5]|max_length[20]|available_display|alpha_numeric');
        $this->form_validation->set_rules('password', 'Password', 'required|min_length[5]|max_length[20]|alpha_numeric');
        $this->form_validation->set_rules('confirm', 'Confirm Pass', 'required|matches[password]');
        
        if($this->form_validation->run() == FALSE){
                
            $variables = array(
                               'VALIDATION_ERRORS' => validation_errors(),
                               'FORM_OPEN' => form_open('register', array('id' => 'contact-form'))                              
                               );
        
            $this->parser->parse('form_register', $variables);
            
        } else {
        
            $this->load->library('email');
            
            $activationCode = random_string('alnum', 16);
        
            $message = '&lt;html&gt;';
            $message .= "&lt;link rel='stylesheet' href='".$this-&gt;config->item('css_dir')."/email.css'>\n";
            $message .= "<h1>Hello, ".$this->input->post('displayName')."!</h1>\n";
            $message .= "<p>As our newest member, we would like to cordially welcome you to SideFX Gaming.  This email was sent so you can complete the registration process and finally begin to access all of our great content.  To login to your new account, please visit the link below.</p>\n";
            $message .= "<p>".anchor($this->config->item('site_url')."/register/activate/".$activationCode, $this->config->item('site_url')."/register/activate/".$activationCode)."</p>\n";
            $message .= "<p>Visiting the above URL should complete the registration process.  If you encounter any problems upon account activation, please contact our support team at [email protected].  Once again, thank you for registering at SideFX Gaming.com!</p>\n";
            $message .= "<p>Sincerly,<br>The SideFX Gaming Team</p>\n";
            $message .= "&lt;/html&gt;";
            
            $this->email->to($this->input->post('emailAddress'));
            $this->email->from("[email protected]", "SideFX Gaming Dot Com!");
            $this->email->subject('SideFX Gaming: Step Two of Three');
            $this->email->message($message);
                $config['mailtype'] = "html";
            $this->email->initialize($config);
            
            if($this->member->create($info = $_POST, $activationCode) && $this->email->send()){
            
                $error = array(
                               'ERROR_HEADING' => 'Step One Complete!',
                               'ERROR_MESSAGE' => 'You have just completed step one of the registration process.  To complete step two, please open the email message you should\'ve gotten when you submitted the form.  To complete step three, visit the activation link provided in the message.  Once you complete these three steps, you should be able to login to your account.  Thank you again for registering with '.$this->config->item('site_name').'!'
                               );
                              
                $this->parser->parse('error_body', $error);
                
            } else {
            
                $error = array(
                               'ERROR_HEADING' => $this->lang->line('fail_title'),
                               'ERROR_MESSAGE' => $this->lang->line('fail_message')
                               );
                $this->parser->parse('error_body', $error);
                
            }                    
            
        }
        
        $this->template->foot();
        
    }

I get the following errors:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1329
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 921
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 570
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Subject

Filename: libraries/Email.php

Line Number: 940
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1519
A PHP Error was encountered

Severity: Warning

Message: mail() expects parameter 1 to be string, array given

Filename: libraries/Email.php

Line Number: 1519
#2

[eluser]ShoeLace1291[/eluser]
bump
#3

[eluser]cahva[/eluser]
Hi,

Doing $this->email->initialize($config) also clears the "to", "from" etc. Place the initialize first before those.
#4

[eluser]Shujin[/eluser]
[quote author="cahva" date="1268836042"]Hi,

Doing $this->email->initialize($config) also clears the "to", "from" etc. Place the initialize first before those.[/quote]
I don't quite understand what to put as $config or where to place this code...




Theme © iAndrew 2016 - Forum software by © MyBB