On Sun, Sep 26, 2010 at 3:09 AM, Jen
Hi Jen - Not too long ago I was involved w/ some code to do exactly this
sort my own mail server, but can’t connect using pony.
:domain => “localhost:chicken”}, :subject => “Optelec tweets”, :body =>
Honestly, I don’t think this hotmailer gem is going to work. Its last
release was December 2006. It also requires Mechanize, and Mechanize has
changed quite a bit since then. If you knew what version of mechanize it
wanted, you could download the correct version, but it doesn’t say, and
can see that some of its use is not correct any more. For example, the
is declared as “class Hotmailer < WWW::Mechanize” but using the WWW
namespace is deprecated.
Its initialize method is:
self.user_agent_alias = “Windows IE 6”
@username = username
@passwd = passwd
@inbox = ‘’
@contacts = 
@messages = 
I don’t know if setting it to “Windows IE 6” is a problem or not, but it
seems quite improbable that you are using IE 6.
Here is where the problem you are running into is coming from:
#Logs in the user
first_page = self.get(‘http://hotmail.com’)
login_form = first_page.form(‘f1’)
login_form.login = self.username
login_form.passwd = self.passwd
You see it gets the page at hotmail.com. Then it tries to fill out the
‘f1’. Looking at the hotmail page, it appears the form is still named
but this method is returning nil (which is why login_form.login raises a
method error – because nil does not have a login method). I expect
this returns nil because you aren’t using the same version of Mechanize
this was written with.
Here are the versions of mechanize
http://rubygems.org/gems/mechanize/versions You might scroll down to
the ones that were released prior to Dec 2006 (when the hotmailer gem
released). Then you can start installing old versions (gem install -v
0.6.3), and in the hotmailer gem, where it requires mechanize, tell it
one you want to use.
I’m not really sure how to tell it which one you want, I think you just
replace (require ‘mechanize’) with (gem ‘mechanize’, ‘=0.6.3’)
Anyway, if that still doesn’t work, theres only about 250 lines of code
that gem, you can possibly sit down with for a while and get it fixed.
find a gem that works better. This one manually logs into the site using
web interface. This is a fun idea, but will break any time hotmail
anything your gem relies on. There are a number of gems related to
email, and I know Rails just got a new one for Rails 3, probably your
bet will be to check one of them out.