Welcome Guest, Not a member yet? Register   Sign In
Error page in production (CI 3)
#3

(This post was last modified: 07-04-2024, 10:19 AM by captain-sensible. Edit Reason: typo )

for use of a "contact us" form the submitted data gets handled in a controller leveraging PHPMailer . I just use a view called info2.php which as :

[CODE}
<?php echo $info;?>

<?php echo $infoException;?>
[/CODE]

I want simple error output if the message doesnt get sent.

In the controller I have



Code:
try

{
//try and send message
}
catch ( \Exception  $e)
                                         {
                                                echo "something went wrong";    
                                         $data = [
                                                    'title'  => 'info',
                                                  
                                               'info'=>'something went wrong with sending message' ,
                                               'infoException'=>$e->getMessage(),
                                               'date'=>$this->myDate,
                                                 ];
                                        
                                            echo view('info2', $data);
                                             die();
                                        
                                            }

So if error is caught i call the view info2.php and pass data to it

im using my gmail to rely out email , when the user name or password is not right as an example the following is output
[CODE}
something went wrong with sending message SMTP Error: Could not authenticate.

[/CODE]

that happened recently ..on a live web in production mode ; key words " could not authenticate" was enough info for me to check user and pass creentials .

with i guess judicious use of try catch in controllers ,you msy be able to set things up for every evenuality
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply


Messages In This Thread
Error page in production (CI 3) - by nico - 07-04-2024, 04:13 AM
RE: Error page in production (CI 3) - by nico - 07-04-2024, 05:28 AM
RE: Error page in production (CI 3) - by captain-sensible - 07-04-2024, 10:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB