Detecting if SMTP server is running

Discussion in 'ASP .Net' started by Ben Fidge, Sep 5, 2005.

  1. Ben Fidge

    Ben Fidge Guest

    Hi

    I'm working on a project where some business process rely on several
    external servers to perform processing. These are Sql Server x 2, Credit
    Card processing and Mail Server.

    Before entering the business process, I'd like to verify that each of these
    are available, in particular the SMTP Server, which is the most volatile of
    the above servers. What would be the best way to detect if the SMTP server
    is up and running?

    Ben
     
    Ben Fidge, Sep 5, 2005
    #1
    1. Advertisements

  2. To ensure that the server is up you can establish connection with it on port
    25. There is a class TcpClient in the .NET Framework. If the server is okay
    the first word in the response from it will be code 220 for more details
    consult the smtp rfc.

    the code to perform connection
    TcpClient tcpClient = new TcpClient ();
    tcpClient.Connect ("smtp.server.name", 25);
    then read the response and check for the status code...

    --
    Vadym Stetsyak aka Vadmyst

    "Ben Fidge" <> wrote in message
    news:...
    > Hi
    >
    > I'm working on a project where some business process rely on several
    > external servers to perform processing. These are Sql Server x 2, Credit
    > Card processing and Mail Server.
    >
    > Before entering the business process, I'd like to verify that each of

    these
    > are available, in particular the SMTP Server, which is the most volatile

    of
    > the above servers. What would be the best way to detect if the SMTP server
    > is up and running?
    >
    > Ben
    >
    >
    >
     
    Vadym Stetsyak, Sep 5, 2005
    #2
    1. Advertisements

  3. Ben Fidge

    Ben Fidge Guest

    Excellent. Thanks for the response. I'll give it a go.

    Regards



    "Vadym Stetsyak" <> wrote in message
    news:...
    > To ensure that the server is up you can establish connection with it on
    > port
    > 25. There is a class TcpClient in the .NET Framework. If the server is
    > okay
    > the first word in the response from it will be code 220 for more details
    > consult the smtp rfc.
    >
    > the code to perform connection
    > TcpClient tcpClient = new TcpClient ();
    > tcpClient.Connect ("smtp.server.name", 25);
    > then read the response and check for the status code...
    >
    > --
    > Vadym Stetsyak aka Vadmyst
    >
    > "Ben Fidge" <> wrote in message
    > news:...
    >> Hi
    >>
    >> I'm working on a project where some business process rely on several
    >> external servers to perform processing. These are Sql Server x 2, Credit
    >> Card processing and Mail Server.
    >>
    >> Before entering the business process, I'd like to verify that each of

    > these
    >> are available, in particular the SMTP Server, which is the most volatile

    > of
    >> the above servers. What would be the best way to detect if the SMTP
    >> server
    >> is up and running?
    >>
    >> Ben
    >>
    >>
    >>

    >
    >
     
    Ben Fidge, Sep 5, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert V. Hanson
    Replies:
    1
    Views:
    779
    Jim Cheshire
    Jul 28, 2003
  2. Adrian Bezzina
    Replies:
    0
    Views:
    644
    Adrian Bezzina
    Aug 7, 2003
  3. Replies:
    3
    Views:
    1,310
    Roedy Green
    Jan 24, 2006
  4. pk
    Replies:
    3
    Views:
    919
    Roedy Green
    Feb 13, 2006
  5. Alex Hunsley
    Replies:
    4
    Views:
    4,402
    Tim Williams (gmail)
    Jun 29, 2004
  6. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    2,109
    Copelandia Cyanescens
    Jul 31, 2004
  7. tshad
    Replies:
    1
    Views:
    1,066
    bruce barker
    May 5, 2008
  8. Andrew Weaver

    SMTP service running on port 26 + CDONTS

    Andrew Weaver, Aug 25, 2003, in forum: ASP General
    Replies:
    3
    Views:
    220
    Ray at
    Aug 25, 2003
Loading...