PHPMailer问题

标签 php phpmailer

我收到错误 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)
}

另见 exception man page

关于PHPMailer问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3507246/

相关文章:

php - 如何对整数+字符串值进行排序?

php - 如何使用 phpMailer 类发送 € 或 € 登录电子邮件主题

php - 使用 GMail 和 phpMailer 发送时为 "Password not accepted from server: 535 Incorrect authentication data"

php - 处理两个人同时在网上商店购买一件独特商品的问题

php - 如果收到 x 则更新列,否则更新 y

php - CodeIgniter 添加和更新数据库没有成功,没有错误,没有,只是不会工作

PHPMailer 异常 :SendAsDeniedException. MapiExceptionSendAsDenied

php - 如何使用 phpmailer 并从 ckeditor 以 html 格式发送邮件

javascript - Node JS 应用程序不处理 php 邮件程序代码

php - 在 MySQL 中为字符列设置空默认值?