Stu Anderson
Stu Anderson

Reputation: 21

Disable Error Reporting at top of Web Page

EDIT: The error message is being displayed from the PHP Mailer script. The real question is how to turn these off :D

Quick (dumb) question but I can't seem to find an answer elsewhere:

I've setup a web page layout and using PHP Mailer to handle the processing of a contact form. I'm handling errors in the form in a generic way within the page body itself, yet various things (such as an invalid email) are displaying errors at the top of the page body (e.g. 'Invalid address:'). I've also encountered the same problem with an SMTP fault I'm working through ('SMTP Error: Could not connect to SMTP host.').

The issue isn't so much the messages (I'm fixing these elsewhere) but that these messages seem to be knackering my layout (especially a CSS grid section at the contact form). I'd prefer these not be displayed, but I'm not sure what's generating them. I have tried a few fixes to turn off PHP warning messages ( error_reporting(E_ERROR | E_PARSE);), or turning off completely but with no success.

So... the question is essentially: where are these messages coming from, and how can (can I?) disable them?

Upvotes: 1

Views: 676

Answers (1)

Stu Anderson
Stu Anderson

Reputation: 21

Aha! The answer was in class.phpmailer.php

It was a setting in the PostSend() function. Was able to comment out line 640 or thereabouts:

echo $e->getMessage()."\n";

Which has stopped it for now! Thanks again!

Upvotes: 1

Related Questions