Return error to function calling PHPMailer instead of global error? #3255
Replies: 2 comments
-
|
If it threw an exception, it means you created the instance using |
Beta Was this translation helpful? Give feedback.
-
|
Changing the initial call to Then I was able to return the error with essentially the following: Now there are no more PHP errors, just nice clean HTTP user errors. I hope my clarification helps others. Thanks for your guidance! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
PHPMailer has been great though I just tried to send an email that was chopped up by someone who clearly has no anti-bot defense on their website. Then PHPMailer triggered a global error instead of return an error response to my calling function.
Either from
$mail->addAddressor$mail->send();. I'm not asking for debugging, I'm simply asking how to change PHPMailer so it returns the error so I can handle it gracefully. In example: letting the user know the to address is malformed instead of say, zero response from the server! Thanks in advance for any constructuve/helpful replies.Beta Was this translation helpful? Give feedback.
All reactions