SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    checking if email is working fine

    Hello

    I wish to use php to check if email is working fine

    I wish to execute a telnet 127.0.0.1 25 , to login on mailserver,
    and send a QUIT command . If the QUIT command is accepted
    and returns correctly "Connection closed by foreign host." all works fine.

    Anyone can tell me how to do this with php ?

    I am able to check is port 25 works fine using

    Code:
    $fp = fsockopen( "127.0.0.1", 25, $errno, $errstr, 5);
    if (!$fp)
    {
    echo"DOWN!";
    }
    else
    {
    echo"ok";
    }
    fclose($fp);
    but I have no idea how to send a QUIT command and verify if the QUIT command is accepted.

    Any help please ?

    Thank you!

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    Italy
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the fwrite and fgets PHP function. Check the Example 1588 in the fsockopen function manual page.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •