Jump to content

[SOLVED] Mail() Function Manual error check


icekat83

Recommended Posts

Hey,

 

I'm new to this forum, although not to PHP but I've hit a wall with this. I have form processor page sending a contact mail and need to suppress error messages of my mail() function (using @). However I want to know if there is an error so is there a way I can check for an error manually, so I can decide what happens? The idea is that the user sees a pretty 'sorry there was an error' message instead of the confusing php error message. Does anyone know of a good method?

 

Thanks,

Alanna.

Link to comment
https://forums.phpfreaks.com/topic/167255-solved-mail-function-manual-error-check/
Share on other sites

I have a line in my code:

 

@mail($recipient, $subject, $msg, $headers); -- with the @ symbol to stop error messages being printed.

 

However if I put in something like:

if(mail()) == false){

  echo 'error';

}

 

I get a message saying that '3 parameters are expected'.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.