Invalid argument supplied for foreach() in Email.php |
[eluser]zoreli[/eluser]
Hi I use CI 2.0.2 version I have a simple register form with 5 fields. When trying to register, form is submitted, but I get the following error. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: libraries/Email.php Line Number: 111 Error occurs when I try to send an e-mail to the new user, that just register. line 111 is Email.php is the following: foreach ($config as $key => $val) Anyone can point me to the solution of this problem? Regards,Zoreli
[eluser]skunkbad[/eluser]
[quote author="zoreli" date="1341875441"]Hi I use CI 2.0.2 version I have a simple register form with 5 fields. When trying to register, form is submitted, but I get the following error. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: libraries/Email.php Line Number: 111 Error occurs when I try to send an e-mail to the new user, that just register. line 111 is Email.php is the following: foreach ($config as $key => $val) Anyone can point me to the solution of this problem? Regards,Zoreli [/quote] Are you extending the mail class? The email class by itself should never have this error.
[eluser]zoreli[/eluser]
Hi skunkbad No, I am not extending it. I downnload the CI 2.1.2 and I replace that file, with the new one and I get the same error. The strange thing is that e-mail is sent successully....But why on earth am getting that error message remain a mystery for me. Regards,Zoreli
[eluser]Aken[/eluser]
We need to know any relevant code, otherwise we're guessing.
[eluser]marjune[/eluser]
first of all what is the value of the variable Code: $config
[eluser]skunkbad[/eluser]
[quote author="marjune" date="1341897020"]first of all what is the value of the variable Code: $config This is a good point. If the email class is initialized with $config as anything but an array, the OP's error would be appropriate.
[eluser]zoreli[/eluser]
Hi Sorry about the delay of responding on the main question here, the value of $config variable. using the print_r, the variable of the $config returns the following: Reply-To: my_valiehere.... Return-Path: my_value_here... From: my_value_herel... Hope this helps
[eluser]InsiteFX[/eluser]
This is telling me that you have not setup the $config array for the email class. CodeIgniter Users Guide - Email Class
[eluser]JoostV[/eluser]
You have either loaded the email library like so Code: $this->load->library('email', $config); Code: $this->email->initialize($config); $config needs to be an array of on or more options to be set, for instance Code: $config = array('mailtype' => 'html'); Judging from the error you are passing a string, not an array. Options that can be set in $config can be found in the user guide. |
Welcome Guest, Not a member yet? Register Sign In |