Message: Call to a member function email->from() on string |
Please help...
I have 2 controllers first controller is home and my sendemail method is working and no problem at all but when I copy the same method to user controller it keeps me getting an error "Message: Call to a member function email->from() on string" heres my method... public function sendEmail($email,$link){ $message = "Hi" $subject = "hello message"; $this->load->library('email'); $this->load->helper(array('email')); $this->email->from('[email protected]', 'Email'); $this->email->to($email); $this->email->subject($subject); $this->email->message($message); $this->email->set_mailtype("html"); if($this->email->send()) return true; else return false; } I am looking forward to your positive response thank you so much...
(04-05-2018, 09:56 AM)php_rocs Wrote: @kylmiko, Looks to me like he is using the string literals '[email protected]' and 'Email' in the call. PHP Code: $this->email->from('[email protected]', 'Email');
(04-05-2018, 08:00 AM)kylmiko Wrote: Please help... https://forum.codeigniter.com/thread-703...#pid352779
(04-05-2018, 10:24 AM)php_rocs Wrote: @Dave friend, The method CI_Email::from() accepts three arguments, all three are strings, the second and third arguments are optional. Read the docs. Nothing happens in the method that would produce the error described. That error message would seem to indicate that the variable $this->email is a string and not an instance of the CI_Email class. How that occurs is not determinable in the code the OP provides. (04-05-2018, 12:05 PM)dave friend Wrote:(04-05-2018, 10:24 AM)php_rocs Wrote: @Dave friend,
Did you try?
PHP Code: $this->email->initialize($config); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |