If your script is looking to get info from another server, just execute an HTTP HEAD request, using fsockopen, and then parse the returned server headers you get from it.
There are several scripts that do that already, look in the source repositories and in the mailing list archive.
As for reading email, if the mail server is using IMAP or POP3, you can use the IMAP functions of PHP to do that. See projects like IMP and TWIG for some code examples.
HTH