我收到错误 Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: ' etc. etc. etc. 页面上真的很刺眼。
所以我想捕获错误或抑制它或其他东西 - 然后将它返回到表单,这样用户就可以被告知有错误并重新输入他们的电子邮件地址。所有这一切都将变得整洁有序,而不是像现在这样乱七八糟的错误。
有人知道怎么做吗?
谢谢
最佳答案
try {
// your code which sends the email
} catch (phpmailerException $exception) {
// process the exception here
// or leave this block blank to just suppress it(which is a bad idea)
}
关于PHPMailer问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3507246/