help me out

S

saro

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 = '(e-mail address removed)'
$to = '(e-mail address removed)'
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(60*60*5)
end


this is the ERROR i got


[root@localhost 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top