This could be that the mailserver is not setup to receive requests
locally. You should attempt to ping the mailserver using the same name
as the script is. If that works, telnet to the mailserver on port 25.
If it doesn't great, simple problem. Mod the MTA configuration to
accept connections from local address.