![]() |
Error with email class in CI 3.1.8 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Error with email class in CI 3.1.8 (/showthread.php?tid=70394) |
Error with email class in CI 3.1.8 - ardavan - 04-04-2018 Hey everybody. I'm trying to use email class as usual. I have loaded the email library in the autoload.php and made an email.php file in my config folder and in my controller trying to send() the email. But I get Error "NOT" on the browser, rather in the log file. I don't have this problem with CI 3.1.5 by the way! Does anyone have any idea? config > email.php PHP Code: defined('BASEPATH') OR exit('No direct script access allowed'); controller PHP Code: $message = $this->load->view('edm/verification', '', TRUE); log file Code: ERROR - 2018-04-04 01:49:43 --> Severity: Error --> Call to a member function from() on string /home1/xxx/public_html/myProject/application/controllers/User.php 129 RE: Error with email class in CI 3.1.8 - php_rocs - 04-04-2018 @ardavan, What is the value for $this->config->item('from') and $this->config->item('appName')? What I mean to say is where (in your code) is the value for $this->config->item('from') and $this->config->item('appName') assigned? RE: Error with email class in CI 3.1.8 - Paradinight - 04-04-2018 (04-04-2018, 12:57 AM)ardavan Wrote: Hey everybody. $this->email is a string not an object. Have you something like $this->email = "string" in the controller? or an attribute $email = "string" ? RE: Error with email class in CI 3.1.8 - ardavan - 04-04-2018 (04-04-2018, 04:49 AM)php_rocs Wrote: @ardavan, the value of them is a string. RE: Error with email class in CI 3.1.8 - ardavan - 04-04-2018 (04-04-2018, 12:14 PM)Paradinight Wrote: $this->email is a string not an object. i am following this https://www.codeigniter.com/user_guide/libraries/email.html#sending-email as i said this works on my another project which is different version of CI (3.1.5) but in 3.1.8 doesnt work. this is my project in CI 3.1.5 which the email works perfectly PHP Code: $from = $this->config->item('email_info'); RE: Error with email class in CI 3.1.8 - Paradinight - 04-04-2018 (04-04-2018, 05:56 PM)ardavan Wrote:(04-04-2018, 12:14 PM)Paradinight Wrote: $this->email is a string not an object. ![]() You override the attribute $email. Search in the controller/my_controller $this->email = "examplestring" and attribute $email = "examplestring" RE: Error with email class in CI 3.1.8 - ardavan - 04-05-2018 i can't understand what's your mean by $this->email = "examplestring" and attribute $email = "examplestring" can you please give me a sample code? even im doing the same on another project with CI 3.1.5 and it works. idk why is not working in 3.1.8 ! RE: Error with email class in CI 3.1.8 - farukga - 04-05-2018 (04-05-2018, 12:18 AM)ardavan Wrote: i can't understand what's your mean by $this->email = "examplestring" and attribute $email = "examplestring" Hi @ardavan Can you please print out $this->config and post your response? RE: Error with email class in CI 3.1.8 - InsiteFX - 04-05-2018 CodeIgniter version 3.1.8 expects all parameters in the from methods to be strings. I would assign your variables to string variables and then pass them into the email form. or cast them to a string to see if that works (string) variable. RE: Error with email class in CI 3.1.8 - ardavan - 04-05-2018 (04-05-2018, 01:02 AM)farukga Wrote:(04-05-2018, 12:18 AM)ardavan Wrote: i can't understand what's your mean by $this->email = "examplestring" and attribute $email = "examplestring" (04-05-2018, 03:31 AM)InsiteFX Wrote: CodeIgniter version 3.1.8 expects all parameters in the from methods to be strings. This is what i got from it and im sure that my from parameter is a String: Code: object(CI_Config)#3 (3) { |