jeudi 11 août 2016

fetching mail via IMAP in rails application

i am trying to fetch my mail from gmail account and store it into my database now i am facing an error during run server using gem 'imap_processor', '~> 1.6'

C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/imap.rb:1057:in `initialize': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) for "smtp.gmail.com" port 143 (Errno::ETIMEDOUT)

  • Unable to load application: Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) for "smtp.gmail.com" port 143

    imap = Net::IMAP.new('smtp.gmail.com')
    imap.authenticate('LOGIN', 'debasish.industrify2016@gmail.com', '*******')
    imap.examine('INBOX')
    imap.search(["RECENT"]).each do |message_id|
    envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
    puts "#{envelope.from[0].name}: \t#{envelope.subject}"
    end
    
    

can any one guide me ?

Aucun commentaire:

Enregistrer un commentaire