views:

39

answers:

1
+2  Q: 

PHPMailer question

I am getting the error Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: ' etc. etc. etc. and it is a real eye sore on the page.

So I want to capture the error or suppress it or something - and then have it be returned to the form so the user can be told there is an error and to re-input their email address. All this will be neat and tidy and not the mess of an error it is now.

Does anyone know how to do this?

Thanks

+3  A: 
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)
}

also, see exception man page

kgb
OK, I was looking at the link - and is usual with PHP their help confuses me more than it ever helps.I would have no idea where to even implement this since phpmailer is the code actually sending the mail. I just tell it what to send and from waht mail server.Thanks
Beauford