Hello,
I'm developing an app that requires the user to define the name of a
Microsoft Exchange Server... I'd like to add functionality that checks
if the server exists. Is there a way to do this? Perhaps with win32ole?
Any help is appreciated!
Thanks,
- Jeff Miller
···
--
Posted via http://www.ruby-forum.com/.
if the server exists. Is there a way to do this? Perhaps with win32ole?
- Jeff Miller
perhaps this is what your looking for?
ip = 127.0.0.1
storage =
storage << system("ping #{ip}")
storage
#=> [true]
···
----------------
ip = 1.0.0.1
storage.clear
storage << system("ping #{ip}")
storage
#=> [false]
- Mac
--
Posted via http://www.ruby-forum.com/\.
Woops, you have to "" ip.
ip = "127.0.0.1"
Otherwise you get a syntax error
Regards,
- Mac
···
--
Posted via http://www.ruby-forum.com/.
thanks! I will test this tomorrow since I'm off work today, but this
looks like what I've been looking for
Could I use the server name instead of the IP in the same way?
···
--
Posted via http://www.ruby-forum.com/.
Could I use the server name instead of the IP in the same way?
Yea no problem there, however I will issue the warning of this:
Wouldn't be hard for someone to slip a del -qf *.* in that system call
and wipe out your drive, at least thats what I think it is on windows.
Just be careful who you let around it
If its just you using it, shouldn't have any problem at all.
Regards,
- Mac
···
--
Posted via http://www.ruby-forum.com/\.
> Could I use the server name instead of the IP in the same way?
Yea no problem there, however I will issue the warning of this:
Wouldn't be hard for someone to slip a del -qf *.* in that system call
and wipe out your drive, at least thats what I think it is on windows.
Just be careful who you let around it
If its just you using it, shouldn't have any problem at all.
Regards,
- Mac
Another way is to check if the server is listening on a port an
Exchange server would listen on, like IMAP4(143), or SMTP(25)
require 'ping'
=> true
Ping.pingecho('exchange_server',5,143)
=> true
Hope that helps,
Gordon
···
On Wed, Apr 16, 2008 at 3:18 PM, Michael Linfield <globyy3000@hotmail.com> wrote:
thanks! It worked flawlessly!!
···
--
Posted via http://www.ruby-forum.com/.
What worked flawlessly? I hope it was Gordon's suggestion, but even
that is not flawless to determine that it's an exchange server. You
need to --for lack of a better term-- "exchange" with it to ensure
that it is, in fact, an exchange server, and a true ping hardly serves
the purpose.
Todd
···
On Thu, Apr 17, 2008 at 3:36 PM, Jeff Miller <loadeddesigns@gmail.com> wrote:
thanks! It worked flawlessly!!
For my purposes, it worked flawlessly. I used this:
ip = params[:ex_name]
storage = []
storage << system("ping #{ip}")
if storage == [true]
blah blah
end
I don't need to determine right away if it is an exchange server or not.
I have also tried Gordon's response, which works. I basically just need
to check whether it's there or not.
Thanks,
- Jeff
···
--
Posted via http://www.ruby-forum.com/.
[mailto:list-bounce@example.com] On Behalf Of Jeff Miller
# ip = params[:ex_name]
# storage = []
# storage << system("ping #{ip}")
# if storage == [true]
# blah blah
# end
···
#
# I don't need to determine right away if it is an exchange
# server or not. I have also tried Gordon's response, which
# works. I basically just need to check whether it's there or not.
just in case you'll need it, you can telnet to it
eg, here is one simple way (among other ways),
require 'net/telnet'
#=> true
x = Net::Telnet::new("Host" => "MYMAIL", "Port" => 25, "telnetmode"=>false)
#=> #<TCPSocket:0x28b0374>
puts x.gets
220 MYMAIL.mydomain.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3
959 ready at Sat, 19 Apr 2008 11:04:57 +0800
#=> nil
that is an exchange 2003 iianm
kind regards -botp