Email Error |
[eluser]apobukay[/eluser]
i use google smtp and it works fine in localhost when send email. then I uploaded my CI file into host server and it gives me an email error when I send email. A PHP Error was encountered Severity: Warning Message: fgets(): supplied argument is not a valid stream resource Filename: libraries/Email.php Line Number: 1818 A PHP Error was encountered Severity: Warning Message: fwrite(): supplied argument is not a valid stream resource Filename: libraries/Email.php Line Number: 1795 what's wrong? do I need to setup anything? please help me. thank you.
[eluser]apobukay[/eluser]
I already know the problem and I already fixed it! I'm done it works fine on live server and localhost!
[eluser]InsiteFX[/eluser]
Care to explain how you fixed! So that other user can fix it if they have the same problem. InsiteFX
[eluser]apobukay[/eluser]
Step 1 Go to email.php file library located in system\libraries\Email.php and look for this code or lines. Step 2 Change the lines line 37 var $smtp_port = "25"; change it to var $smtp_port = "465"; // Gmail smtp port because I use gmail email ---------------------------- line 41 var $mailtype = "text"; change it to (optional ) var $mailtype = "html"; -------------------------- line 47 var $newline = "\n"; change it to var $newline = "\r\n"; ------------------------ line 48 var $crlf = "\n"; change it to var $crlf = "\r\n"; ----------------------------------------- Step 3 write this code in your Controller Class function anything_You_want() { $this->load->library('email'); $this->email->set_newline("\r\n"); $this->email->from('[email protected]','YourNameHere'); $this->email->to('you To string'); $this->email->subject('your subject string'); $this->email->message('your message string'); if($this->email->send()) { echo 'Message Sent'; } else { echo $this->email->print_debugger(); //you can use this for error message instead of print_debugger() echo 'seding message failed'; } } Ok I hope it will help everybody. apobukay
[eluser]Twisted1919[/eluser]
LOL. What you've done could be accomplished by using the config and the initialize() method (don't pass the config array to the library constructor, just initialize the config with the method). At most, if for some reason that wouldn't work, you would extend the email class with your own, but to do what you did, bad decision.
[eluser]Twisted1919[/eluser]
You gotta be kidding me right ? If you need to connect to a google account and to other kind of account from same app, what do you do ?
[eluser]apobukay[/eluser]
i don't know what to do.. will you please tell me what to do? thanks
[eluser]Twisted1919[/eluser]
Revert back all your changes done to the email library, and instantiate the library class like: Code: $this->load->library('email');
|
Welcome Guest, Not a member yet? Register Sign In |