PHPMailer问题

时间:2010-08-17 21:48:36

标签: php phpmailer

我收到错误致命错误:未捕获异常'phpmailerException',消息'无效地址:'等等,这是一个真正的眼睛痛。页面

所以我想捕获错误或抑制错误或其他东西 - 然后将其返回到表单,以便可以告诉用户有错误并重新输入他们的电子邮件地址。所有这些都将是整洁的,而不是现在的错误。

有谁知道怎么做?

由于

1 个答案:

答案 0 :(得分:4)

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