look / fetcher Goto Github PK
View Code? Open in Web Editor NEWdownload email from POP3 or IMAP and do stuff with it.
License: MIT License
download email from POP3 or IMAP and do stuff with it.
License: MIT License
-VirtualBox:~/Source/email/fetcher$ rails generate fetcher_daemon mail
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released.
Got this error while fetching IMAP email via Gmail
/Work/cashboard/site/trunk/vendor/rails/railties/lib/commands/runner.rb:45: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:288:in shutdown': Socket is not connected (Errno::ENOTCONN) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:288:in
disconnect'
from /Work/cashboard/site/trunk/vendor/plugins/fetcher/lib/fetcher/imap.rb:69:in close_connection' from /Work/cashboard/site/trunk/vendor/plugins/fetcher/lib/fetcher/base.rb:33:in
fetch'
from (eval):9
from /Library/Ruby/Gems/1.8/gems/lockfile-1.4.3/lib/lockfile.rb:284:in lock' from /Library/Ruby/Gems/1.8/gems/lockfile-1.4.3/lib/lockfile.rb:539:in
attempt'
from /Library/Ruby/Gems/1.8/gems/lockfile-1.4.3/lib/lockfile.rb:539:in catch' from /Library/Ruby/Gems/1.8/gems/lockfile-1.4.3/lib/lockfile.rb:539:in
attempt'
... 7 levels...
from /Work/cashboard/site/trunk/vendor/rails/railties/lib/commands/runner.rb:45
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
from script/runner:3
Changing the "close_connection" method in imap.rb fixes the error.
# Delete messages and log out
def close_connection
@connection.expunge
@connection.logout
@connection.disconnect unless @connection.disconnected?
end
Installation for rails 3 is done by.
rails plugin install git://github.com/look/fetcher.git
rails generate fetcher_daemon MailerDaemon
Ran into a strange one.
This error shows up when connecting to Gmail and trying to create a new folder.
It seems to depend on the capitalization. When I have label names in my mail.yml
like this:
in_folder: inbox
processed_folder: processed
error_folder: error
or this
in_folder: INBOX
processed_folder: PROCESSED
error_folder: ERROR
It gives the error.
But when I set them like this:
in_folder: Inbox
processed_folder: Processed
error_folder: Error
It works! Go figure.
Not sure why Gmail cares about the capitalization.
Turning off SSl verification as described here didn't seem to help.
https://github.com/look/fetcher/issues#issue/8
Sometimes I get this error:
Errno::ENOTCONN: Socket is not connected
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:288:in shutdown' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/imap.rb:288:in
disconnect'
from /Users/jnylund/Projects/aras/vendor/plugins/fetcher/lib/fetcher/imap.rb:69:in close_connection' from /Users/jnylund/Projects/aras/vendor/plugins/fetcher/lib/fetcher/base.rb:33:in
fetch'
from (irb):9
Once I get it, I have to create a new Fetcher to get any more email.
Ruby 1.8.6 (osx) , have the latest fetcher (as of 2 days ago), rails 2.3.5. System Timer 1.0
any ideas?
Hi, I was able to fetch from Gmail, but one weird thing I noticed was the to and from address are prefixed with dashes, its very weird. I can trim them off, but was wondering if anyone else had seen this and if there was a fix out there.
looks like this, email between double quotes:
"--- - [email protected]"
thanks
Joel
I know, I know, it kinda defeats the point of SSL entirely, but there's legitimate cases where this is useful (e.g, Gmail having SSL issues randomly, all you care about is the emails, SSL isn't truly a problem in this case and you don't really care about security).
I implemented a patch for this - the following option would have to be specified in the config parameters:
ssl_verification: false
Then the core file (fetcher/lib/fetcher/imap.rb, around line 40) would be this:
def initialize(options={})
@authentication = options.delete(:authentication) || 'PLAIN'
@port = options.delete(:port) || PORT
@ssl = options.delete(:ssl)
@ssl_verification = options.delete(:ssl_verification)
@use_login = options.delete(:use_login)
@in_folder = options.delete(:in_folder) || 'INBOX'
@processed_folder = options.delete(:processed_folder)
@error_folder = options.delete(:error_folder) || 'bogus'
super(options)
end
# Open connection and login to server
def establish_connection
timeout_call = (RUBY_VERSION < '1.9.0') ? "SystemTimer.timeout_after(15.seconds) do" : "Timeout::timeout(15) do"
eval("#{timeout_call}
@connection = Net::IMAP.new(@server, @port, @ssl, nil, @ssl_verification)
if @use_login
@connection.login(@username, @password)
else
@connection.authenticate(@authentication, @username, @password)
end
end")
end
If I have time I'll fork and make a real patch, but I find myself incredibly busy these days. Figured it's worth noting here for anyone else who runs into this issue, if nothing else.
Google Buzzwords: Ruby, Gmail, IMAP, SSL, Certificates, Verify
Just a quick question. I'm running Rails 2.3.8 with Ruby 1.8.7 on Engine Yard. I'm not sure what version of the plugin is installed, but i checked out the code and it looks like it might still be using Timeout.rb for POP, even though IMAP is set to use SystemTimer if it's there.
Should I set POP to use SystemTimer or is that only an IMAP issue? The server has experienced performance issues in the past.
Thanks,
DC
I'm using Fetcher and monit on a rails app (thanks MMS2R). Monit keeps the process up for days, and Fetcher always grabs emails from the inbox i point it at. However after an unspecified period of time (roughly 6+ hours) after restarting the process, it fails to deliver the mail to my receive method. It still pulls them off the postfix server (verified through email log) but when i check my production database, there are no new entries.
For the first 6-ish hours i do see entries in my production DB, and at any time I can manually go into RAILS_ENV=production script/console and successfully test the receive method and verify entries in my production DB. Has anyone run into something similar?
If this isn't the proper place to address this issue please point me in the right direction. rails 2.2.2, ubuntu hardy, passenger, and ruby 1.8.6 .
I get this error when I try to generate a daemon. I have ruby 1.8.7 and rails 2.3.8.
I installed the fetcher daemon by doing:
script/plugin install git://github.com/look/fetcher.git
What could I be doing wrong?
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- rails/generators (MissingSourceFile) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
I'm not sure what other relevant information to give. But monit seems to be having to relaunch the fetcher daemon between every 1-5 days. I suppose it's crashing, and I'm not sure if this would show up in any logs anywhere.
Hi, I need to attach an email I receive to an outbound message, to do this, I need the entire thing. Is there a way to get the raw string out of the Tmail:Mail message?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.