Welcome Guest, Not a member yet? Register   Sign In
Date Error when Emailing with Code Igniter
#7

[eluser]eldrinofsoalim[/eluser]
Here is the code:
Code:
<?php
    /**
    * SENDS E-MAIL WITH GMAIL
    */
    class Email extends Controller {
        
        function __construct() {
            parent::Controller();
            date_default_timezone_set("Asia/Manila");
        }
        
        function index(){

                
            $this->load->library('email', $config);
            $this->email->set_newline("\r\n");
            
            $this->email->from('[email protected]', 'John Doe');
            $this->email->to('[email protected]');
            $this->email->subject('This is a test e-mail');
            $this->email->message('It is working. Great!');
    
            $path = $this->config->item('server_root');
            
            $file = $path . '/PoweredByMacOSX.gif';

            $this->email->attach($file);
            
            if($this->email->send()) {
                echo 'Yup! Your e-mail was sent.';
            }
            else {
                show_error($this->email->print_debugger());
            }
        }
    }
    
?>

As you can see, the...
Code:
date_default_timezone_set("Asia/Manila");
is in the __construct function where it worked. If I put the same code in the index, the error still occurs.

What's the difference between index() function and the __construct() function if both are just instantiated when called?

Thanks for the help!


Messages In This Thread
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:04 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:17 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:22 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:23 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:32 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:49 PM
Date Error when Emailing with Code Igniter - by El Forum - 01-05-2011, 10:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB