PLEASE HELP ME OUT
This is my program and here i have tried to retrieve mails from my
inbox to my mobile but i got some error I cant clear it and understand
where it is
#!/usr/bin/evn ruby
forward_important_messages.rb
require ‘net/pop’
require ‘net/smtp’
$address = 'www.yahoomail.com ’
$from = ‘[email protected]’
$to = ‘[email protected]’
smtp_server = ‘smtp.mail.yahoo.com’
pop_server = ‘pop.mail.yahoo.com’
username = ‘tamizhansaro’
password = ‘ago822tore584’
$found = Hash.new
def send_msg
count = 1
while(text.size > 0) do
# SMS message limited to 160 characters
msg = text.slice!(0, 159)
full_msg = “From: #{$from}\n”
full_msg += “To: #{$to}\n”
full_msg += “Subject: Found message from #{$address} (#{count})!
\n”
full_msg += “Date: #{Time.now}\n”
full_msg += msg + “\n”
Net::SMTP.start(smtp_server, 25) do |smtp|
smtp.send_message full_msg, $from, $to
end
count += 1
end
end
loop do
conn = Net::POP3.new(pop_server,995)
conn.start(‘username’,‘password’)
uidls = conn.mails.collect do |msg|
msg.uidl
end
uidls.each do |one_id|
if ! $found.has_key? one_id
$found[one_id] = true
conn.each_mail do |msg|
send_msg(msg.uid1) if msg.uid1==one_id
end
end
end
conn.finish
sleep(60605)
end
this is the ERROR i got
[[email protected] Desktop]# ruby phone1.rb
/usr/local/lib/ruby/1.8/net/protocol.rb:206:in initialize': getaddrinfo: Temporary failure in name resolution (SocketError) from /usr/local/lib/ruby/1.8/net/protocol.rb:206:in
new’
from /usr/local/lib/ruby/1.8/net/protocol.rb:206:in old_open' from /usr/local/lib/ruby/1.8/timeout.rb:56:in
timeout’
from /usr/local/lib/ruby/1.8/timeout.rb:76:in timeout' from /usr/local/lib/ruby/1.8/net/protocol.rb:206:in
old_open’
from /usr/local/lib/ruby/1.8/net/pop.rb:438:in do_start' from /usr/local/lib/ruby/1.8/net/pop.rb:432:in
start’
from phone1.rb:35
from phone1.rb:33:in `loop’
from phone1.rb:33