473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Detecting if SMTP server is running

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

Nov 17 '05 #1
2 4307
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" <be*******@btopenworld.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2
Excellent. Thanks for the response. I'll give it a go.

Regards

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
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" <be*******@btopenworld.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Nancy | last post by:
Hi, Guys, Is there any other way to use python or mod_python writing a web page? I mean, not use "form.py/email", no SMTP server. <form action="form.py/email" method="POST"> ... Thanks a lot. ...
0
by: Mark Miller | last post by:
I'm puzzled by this situation. I'm running on Windows XP Pro 2002 SP 2. I started on an ASP.Net project, initially using the standard SmtpServer and MailMessage classes. For testing, I used the...
8
by: Sue | last post by:
Does this "NT-based machine (NT, 2K, XP)" mean a WindowsXP machine is a NT-based machine? What does NT stand for and what does it mean? What is CDONTS? What does this mean - "The machine...
7
by: Razzie | last post by:
Hey all, I need to connect to an SMTP server and get a notification when it gets a new mail to send. I want to be able to 'read' that email (retrieve recipient information for example). Is that...
1
by: bivin | last post by:
hai i am requesting your technical support. please help me. i have been working with this for five days. the problem is relating with the smtp. i am trying to send an email from the asp.net...
5
by: R. Ian Lee | last post by:
I'm using the System.Web.Mail.SmtpMail object (.NET 1.1) to send email from an ASP.NET application. Everything works fine when I run it from Windows 2000 Server, but not from WinXP Pro. Is it...
1
by: Srinivas | last post by:
Hi, I am using ASP.NET SmtpMail to send email using the following code public void SendEmail(string From, string To, string Subject, StringBuilder Message, string Attachment, string...
6
by: John Salerno | last post by:
If I want to write a cgi script that reads the contents of an HTML form and emails it to me, what would I use as the host parameter for my SMTP instance? The example in the docs is 'localhost', but...
3
by: Ing. Davide Piras | last post by:
Hi there, I use Visual Studio 2005, c# projects... I like the new unit test framework very much, it helps a lot mantaining and growing up a project with the test driven paradigm, that's so good!...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.