Error with email class in CI 3.1.8 |
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
@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?
(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" ? (04-04-2018, 04:49 AM)php_rocs Wrote: @ardavan, the value of them is a string. (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/l...ding-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');
(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"
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 ! (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?
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(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) { |
Welcome Guest, Not a member yet? Register Sign In |