![]() |
Controller stops code execution after sending mail with email class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Controller stops code execution after sending mail with email class (/showthread.php?tid=38129) |
Controller stops code execution after sending mail with email class - El Forum - 01-31-2011 [eluser]Milaan[/eluser] Hello, i have a controller function which handles the AJAX request for creating a new user. Now while the request is being processed i want to send an email to an admin that a new user was created. If all validation and database inserts are complete i want to do the following: Code: $output['result'] = 'User created successfully'; Now the problem is, when i create a new user in the web interface, everything is working fine. The E-Mail is successfully sent to the admin but i dont receive a json response from the PHP. If i comment out the conditional mail part, i receive the json output. Placing the output before the conditional email part didnt work either. It seems that my code somehow stops executing after the $this->email->send() function was called. Anyone has an idea? Controller stops code execution after sending mail with email class - El Forum - 01-31-2011 [eluser]tomcode[/eluser] Just an idea : Maybe an error is generated somewhere, can be nasty to track with ajax, have a look into the logs. Controller stops code execution after sending mail with email class - El Forum - 01-31-2011 [eluser]InsiteFX[/eluser] Either that or the session is writing a new session_id InsiteFX Controller stops code execution after sending mail with email class - El Forum - 02-01-2011 [eluser]Milaan[/eluser] Logs are empty... i mean, no errors show up. The last log line shows always where the view file gets loaded into the email message. Session ID, hmmm. Why should email trigger an new session_id? It's not, that this error happens just once in a time. It happens everytime. Controller stops code execution after sending mail with email class - El Forum - 02-01-2011 [eluser]tomcode[/eluser] Try assigning the view content to a variable instead of directly passing it as param to the message method, I remember a case where this revealed an error which would not show otherwise. Controller stops code execution after sending mail with email class - El Forum - 02-01-2011 [eluser]Milaan[/eluser] [quote author="tomcode" date="1296575340"]Try assigning the view content to a variable instead of directly passing it as param to the message method, I remember a case where this revealed an error which would not show otherwise.[/quote] Again, no luck... Code: DEBUG - 2011-02-01 10:52:25 --> Model Class Initialized Very strange is, that the email is being sent as expected and everything is loaded from the view file just as i want it to. But i have found out one thing more... I use jQuery AJAX function for this stuff and i force the AJAX function to return an alert window with the server response when the AJAX request was successfully sent i receive "500 Internal Server Error". If i comment out the $this->email function, the server returns "200 OK". Controller stops code execution after sending mail with email class - El Forum - 02-01-2011 [eluser]tomcode[/eluser] So You found Your error ... Controller stops code execution after sending mail with email class - El Forum - 02-01-2011 [eluser]Milaan[/eluser] [quote author="tomcode" date="1296576690"]So You found Your error ...[/quote] Yes indeed. I rewrote my function a little bit to answer on a get request and open the page directly in the browser. What CodeIgniter didn't say in the log file ... the german language file for email was missing. Hah! Guess the CI Team should include such errors messages in the log file too. Thank you for your help :-) |