From: "Peña, Botp" Date: 2007-04-27T11:15:18+09:00 Subject: Re: Hoq to send a message/mail to particular ip On Behalf Of Veera Sundaravel: # 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=, relay=192.168.25.4[192.168.25.4], delay=1, status=sent (250 2.6.0 <20070427020010.A58DA27EAE@pc4all.botp.bugo.dmpi> 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:' puts t.gets t.puts 'RCPT TO:' 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 . 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