Welcome Guest, Not a member yet? Register   Sign In
Email Library Issues
#14

You have a form_validation rule which calls check_email() in the customers_model. The check_email() function not only loads the model in which it is defined (if you're lucky, this is a wasted call), then calls $this->customers_model->initialize() (which wipes out the email library, if it has been loaded, by setting $this->email = NULL), then proceeds to set $this->customers_model->email = $email, so you now have a string where the library previously would have been.

The only way you can access the email library from within the customers_model after doing all of that would be through get_instance()->email (or $ci = get_instance(); then using $ci->email->from() etc.). This is because the email library is normally made available to the model by way of the __get() magic method in CI_Model, but __get() won't be used if you've defined the property (which you've done by assigning it a value in both initialize() and check_email()).
Reply


Messages In This Thread
Email Library Issues - by acheng16 - 01-05-2016, 02:03 PM
RE: Email Library Issues - by skunkbad - 01-05-2016, 03:41 PM
RE: Email Library Issues - by Narf - 01-05-2016, 05:07 PM
RE: Email Library Issues - by skunkbad - 01-05-2016, 08:11 PM
RE: Email Library Issues - by acheng16 - 01-05-2016, 11:14 PM
RE: Email Library Issues - by skunkbad - 01-06-2016, 12:06 AM
RE: Email Library Issues - by acheng16 - 01-06-2016, 08:36 AM
RE: Email Library Issues - by webdeveloper - 01-06-2016, 08:46 AM
RE: Email Library Issues - by skunkbad - 01-06-2016, 09:03 AM
RE: Email Library Issues - by acheng16 - 01-06-2016, 09:12 AM
RE: Email Library Issues - by webdeveloper - 01-06-2016, 09:33 AM
RE: Email Library Issues - by acheng16 - 01-06-2016, 09:55 AM
RE: Email Library Issues - by acheng16 - 01-06-2016, 11:39 AM
RE: Email Library Issues - by mwhitney - 01-08-2016, 12:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB