Jump to content

How to check if a function works


terryds

Recommended Posts

I have a mail function in my signup.phpBut, i don't know how to check if the mail function works... I used this code

 $delivery = mail ($to, $subject, $msg, 'From: ' . $email); if ($delivery) {echo 'Your form has been sent to Admin' . '<br />';}else{echo 'Failed to send the form. Try Again' . '<br />';}

I had thought that it would solve the problem.. But, it would not ! I disconnected from the internet then i opened my signup.php, click 'submit'..But, it said that the form has been sent although i had disconnected from internet.. Would you please tell me the correct code to make the function-checker work ?

Link to comment
Share on other sites

Local server does not need internet connection to work. your computer basically sends request to itself. mail returns boolean true on success anda false on failure. check the behaviour of mail() details here.http://php.net/mail Though returning true does not ensure sending of mail. it depends on mail server installed on the machine too.

Link to comment
Share on other sites

The mail function returning true only means that the mail transfer agent on your server accepted the mail for sending, it doesn't mean that the mail was delivered successfully. There's not a way to check for that other than to monitor the email account that the mail was sent from for a rejected or bounced message.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...