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. Advertising

  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. Advertising

  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. Advertising

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. Replies:
    3
    Views:
    1,130
    Roedy Green
    Jan 24, 2006
  2. Alex Hunsley
    Replies:
    4
    Views:
    3,682
    Tim Williams (gmail)
    Jun 29, 2004
  3. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    911
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
  4. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    1,575
    Copelandia Cyanescens
    Jul 31, 2004
  5. tshad
    Replies:
    1
    Views:
    913
    bruce barker
    May 5, 2008
Loading...

Share This Page