I created a simple server ping script that changes an icon from green to red when the server is unreachable. I would also like it to send me an email, but haven't quite got it worked out. The icon changes, but the email does not get sent. Here's the line in question:

$machine = fSockOpen($server, $port); if (!$machine) { echo "<img src=\"http://localhost/off.jpg\">"; mail('you@yoursite.com', 'Hello', $server.' is unreachable');}
Any help appreciated. Thanks.