Welcome Guest, Not a member yet? Register   Sign In
Cannot send auto email in codeigniter

Dear All,

I have try to send a auto email if i have birth day in my list. But It not send auto that i mention time. Any one can help me to fix this auto email..

My controller:

PHP Code:
function test()
        if($this->Backup_model->testmail() === true){
            $now date_default_timezone_set('Asia/Colombo'); // Set Time-Zone
            $now date('H:i:A'); //Fomat Date and time
            $now '20:28';

            if ($now === true){

                $this->email->from('[email protected]''Sanjaya prasanna');
                $this->email->to('[email protected]');
                // $this->email->cc('[email protected]');
                //$this->email->bcc('[email protected]');

                $this->email->subject('New Requisition has been Arrived !');

                    // echo "Your Email Has Been Sent.";
                    echo "Your Request not sent. Try again later";



My Model:

PHP Code:
function testmail()
       $query $this->db->query("SELECT * FROM birth_day WHERE month(date) = month(curdate()) and day(date) = day(curdate());");
       $email_data $query->result_array();
       return $email_data;


You would need to get the users record from the database when a user login and get all records with today's date.

If more then one record use a foreach loop to go through them all if the database records date = today's date
then send the email.

I think you would be better off using a cron job for this and call a CI Controller to do it all everyday.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB