Forum: Ruby Hoq to send a message/mail to particular ip

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Veera S. (Guest)
on 2007-04-26 05:17
Hello everybody !

I'm newbie to ruby. Is there anyway to send a message or mail to
particular available ip. Please give some suggestion.

Regards,
Veeraa.
Phillip G. (Guest)
on 2007-04-26 16:59
(Received via mailing list)
Veera S. wrote:
> Hello everybody !
>
> I'm newbie to ruby. Is there anyway to send a message or mail to
> particular available ip. Please give some suggestion.

Not emails. email addresses aren't linked to IPs. Your only chance is,
if it is a UNIX, talk is installed, and accessible for you. Otherwise
you need to develop a client/server solution (SSH and telnet are
possibilities, too, if you have access to them on your recipient).

Usually, one uses IPs to talk to machines, and emails to talk to people.
;)

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #4:

If you don't work on your project, chances are that no one will.
Robert K. (Guest)
on 2007-04-26 17:30
(Received via mailing list)
On 26.04.2007 03:17, Veera S. wrote:
> I'm newbie to ruby. Is there anyway to send a message or mail to
> particular available ip. Please give some suggestion.

What exactly do you mean by this?  Can you elaborate a bit more?

Kind regards

  robert
Veera S. (Guest)
on 2007-04-26 21:44
Robert K. wrote:
> On 26.04.2007 03:17, Veera S. wrote:
>> I'm newbie to ruby. Is there anyway to send a message or mail to
>> particular available ip. Please give some suggestion.
>
> What exactly do you mean by this?  Can you elaborate a bit more?
>
> Kind regards
>
>   robert


Hi,

For example if an user registered his information in my application with
his static ip, then here i want to send a message when the user is in
internet connection. ( but he dont need to login my application).


Regards,
Veeraa.
Dan Z. (Guest)
on 2007-04-27 00:53
(Received via mailing list)
Hi,

If you want a general solution that will work for anybody, you are out
of luck. For example, if the person is on a corporate network or behind
any router (and is thus firewalled), you can't contact them by IP at
all. Further, there is no way to send an email to a person by knowing
their IP. You must know what their email address is, both username and
e-mail host. However, if you can make some assumptions about your users,
you might be able to think of something.

I think in the past, you might have been able to use Windows Messenger
to send messages to arbitrary IP addresses (not sure how it worked, but
it really annoyed me), but I assume that's patched in recent service
packs of Windows, and it's not a reliable way to communicate because
people turn that service off (if they can).

Someone else mentioned the unix program "talk", but I don't think that
is commonly used. I would give up on an automatic solution--if you need
to do this, you probably need to make them log into your site, and get
their email addresses when they first sign up.

Good luck,
Dan
Peña, Botp (Guest)
on 2007-04-27 06:23
(Received via mailing list)
On Behalf Of Veera S.:
# I'm newbie to ruby. Is there anyway to send a message or mail to
# particular available ip. Please give some suggestion.

i'm not sure if this really involves ruby.

you want to mail to an ip, this assumes
  1. you wont use dns
  2. you have a mail server running on that ip

---------
Option I
---------
use the [] op instead of the domain or mail server name in sending the
email, eg

botp@pc4all:~$ mail botp@[192.168.25.4]
Subject: test
.
Cc:
Null message body; hope that's ok

botp@pc4all:~$ tail /var/log/mail.info
   Apr 27 10:00:11 localhost postfix/smtp[6351]: A58DA27EAE:
to=<botp@[192.168.25.4]>, relay=192.168.25.4[192.168.25.4], delay=1,
status=sent (250 2.6.0
<removed_email_address@domain.invalid> Queued mail for
delivery)
botp@pc4all:~$

---------
Option II
---------
create a crude script to simulate smtp and specify your email server(S),
eg
(note, here i'm being fancy, i'm sending/relaying mail thru 10.2.10.1 wc
delivers it to 192.168.25.4)

C:\family\ruby\mail>cat simple.rb
require 'socket'
t = TCPSocket.new('10.2.10.1', 25)
puts t.gets
t.puts 'HELO Welcome from Ruby'
puts t.gets
t.puts 'MAIL FROM:<removed_email_address@domain.invalid>'
puts t.gets
t.puts 'RCPT TO:<botp@[192.168.25.4]>'
puts t.gets
t.puts 'DATA'
puts t.gets
t.puts 'Test Email from Ruby'
t.puts "\r\n.\r\n"
puts t.gets
t.puts 'QUIT'
puts t.gets
t.close


C:\family\ruby\mail>ruby simple.rb
220 pc4all.botp.bugo.dmpi ESMTP Postfix (Ubuntu latest)
250 pc4all.botp.bugo.dmpi
250 Ok
250 Ok
354 End data with <CR><LF>.<CR><LF>
250 Ok: queued as 9856027EAE
221 Bye

---------
Option I
---------
Use ruby's net/smtp which is way cooler and is left as an exercise (but
you'll have to understand the smtp fundamentals first)

hth.
kind regards -botp
Robert K. (Guest)
on 2007-04-27 11:45
(Received via mailing list)
On 26.04.2007 19:44, Veera S. wrote:
> Robert K. wrote:
>> On 26.04.2007 03:17, Veera S. wrote:
>>> I'm newbie to ruby. Is there anyway to send a message or mail to
>>> particular available ip. Please give some suggestion.
>> What exactly do you mean by this?  Can you elaborate a bit more?
>
> For example if an user registered his information in my application with
> his static ip, then here i want to send a message when the user is in
> internet connection. ( but he dont need to login my application).

So we have two tasks here

1. Detect that someone is online.

2. Send a message.

ad 1) as Dan pointed out there is no general way that would reliably
work.

ad 2) you do not state what kind of message is to be send.  But
considering futility of 1 it's probably not worth digging deeper into 2
either.

Kind regards

  robert
This topic is locked and can not be replied to.