Mail error codes from local host

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigel-9SW
Forum Newbie
Posts: 8
Joined: Tue Oct 15, 2002 2:14 am
Location: UK

Mail error codes from local host

Post by nigel-9SW »

I am using a local server to test my web pages, I have an 'mail' instruction in my php code - see sample.

I receive an error message as follows, I am sure it is easy to fix and create an email message that gives the impression that the server has sent the mail. (Apache 2.0.43 Win32)

Warning: Failed to Receive in C:\Web_documents\My Websites\RSGolf\php\handleform.php on line 47

Thx in advance

Code: Select all

<?php 
if ($CallFunction) {
   mail("my.name@mail.com","New Post received",$Body);
   print ("<H3>Thanks for your feedback which now appears in the 
<A HREF="..\html\postroom.php" TARGET="mainbody">postroom</A> </H3>");
} else {
 print ("<H3>Due to a system error your message has not been processed, please try later</H3>");
}

?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you just don't want the error to appear during local testing you can suppress it by using '@':

Code: Select all

@mail("my.name@mail.com","New Post received",$Body);
@ will hide any error messages caused by the mail function

Mac
User avatar
nigel-9SW
Forum Newbie
Posts: 8
Joined: Tue Oct 15, 2002 2:14 am
Location: UK

Post by nigel-9SW »

:D Good tip thx
Post Reply