Jump to content

Is there a way to detect if the mail() function was succesful?


Xurion

Recommended Posts

I have a line of code in my php page that send an email with the following code:

mail('[email protected]','my subject','email text',$mailheaders);

When the page loads, it will display the confirmation message saying thank you etc. But if for whatever reason the smtp of the server is down, if there any php that can detect this?

Thx in adv.

Xur~
the mail() function returns true if successfull or false if failed. so this would work:

[code=php:0]
if(mail('[email protected]','my subject','email text',$mailheaders)){
echo "Message was sent!";
}else{
echo "Problem sending message!";
}
[/code]

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.