disable phpmailer error messages
When I send the mail I am getting the error messages on the screen, things like...
> Invalid address: Invalid addre开发者_开发百科ss:
> 423Invalid address: 423
How can I switch this off?
Thanks,
R.
Add the following setting.
$mail->SMTPDebug = false;
$mail->do_debug = 0;
I had the same problem and fixed it commenting the line that have the echo that displays the error.
if (!self::ValidateAddress($address)) {
$this->SetError($this->Lang('invalid_address').': '. $address);
if ($this->exceptions) {
throw new phpmailerException($this->Lang('invalid_address').': '.$address);
}
//echo $this->Lang('invalid_address').': '.$address; <----- COMMENT THIS LINE (LINE 464)
return false;
}
After this, even that the address is invalid, the message is not displayed.
by Tronks
With the amount of information we have from the question I'm not sure the answer is correct but, when you put the @
sign before the mail function.
@mail($to, $subject, $message, $headers);
Suppreses the errors, but you h¡should hide errors for "sticking your head under the sand", this should be done to avoid ugly/unfriendly erros etc, you shouldn't hide from your errors.
Throw errors is ok, but if you intend to catch the (error) result and map it into an own result (e.g. you want to create an json result) you'll get a problem with these html outputs.
精彩评论