retrieving Yahoo mail with Net::IMAP

T

Tadeusz Bochan

Hi,
I'm trying read my email from BT Yahoo cos they seem to have withdrawn
their archive facility recently.

However, when I try the following, it just hangs forever :

loginid=%w{myuserid mypass}
pp (imap = Net::IMAP.new("mail.btinternet.com",587))
pp (imap.capability # or imap.authenticate("LOGIN",*loginid))

Seems to connect ok, but then NUTTIN !

Any suggestions please ?

(or does anyone know why Yahoo pulled the plug on their archive option
?)
 
7

7stud --

Tadeusz said:
Hi,
I'm trying read my email from BT Yahoo cos they seem to have withdrawn
their archive facility recently.

However, when I try the following, it just hangs forever :

loginid=%w{myuserid mypass}
pp (imap = Net::IMAP.new("mail.btinternet.com",587))
pp (imap.capability # or imap.authenticate("LOGIN",*loginid))

Seems to connect ok, but then NUTTIN !

Any suggestions please ?

(or does anyone know why Yahoo pulled the plug on their archive option
?)


I don't know what BT Yahoo is, but do you pay a yearly fee? As far as I
know, Yahoo! does not allow access to their mail servers unless you pay
them--although I think some international versions do allow free access
to POP3 mail servers.

http://answers.yahoo.com/question/index?qid=20071029185456AAWGQAK
 
T

Tadeusz Bochan

Tadeusz said:
Hi,
I'm trying read my email from BT Yahoo cos they seem to have withdrawn
their archive facility recently.

However, when I try the following, it just hangs forever :

loginid=%w{myuserid mypass}
pp (imap = Net::IMAP.new("mail.btinternet.com",587))
pp (imap.capability) # or imap.authenticate("LOGIN",*loginid)

Seems to connect ok, but then NUTTIN !

Any suggestions please ?

(or does anyone know why Yahoo pulled the plug on their archive option
?)

In my original note, I used port 587, which seems to be an alternate
outgoing port, so that explains the hang.

When I used the standard imap port 143, I get:
No connection could be made because the target machine actively refused
it. - connect(2) (Errno::ECONNREFUSED)

Maybe Yahoo uses another port number ?
I've spent hours and hours searching and experimenting.
Any help would make my day.
 
7

7stud --

Tadeusz said:
In my original note, I used port 587, which seems to be an alternate
outgoing port, so that explains the hang.

When I used the standard imap port 143, I get:
No connection could be made because the target machine actively refused
it. - connect(2) (Errno::ECONNREFUSED)

Maybe Yahoo uses another port number ?
I've spent hours and hours searching and experimenting.
Any help would make my day.


1) First, your code is not connecting to yahoo's mail servers. The mail
server's name in your code is:

mail.btinternet.com

2) Do you pay for Yahoo! mail?
 
T

Tadeusz Bochan

7stud said:
I don't know what BT Yahoo is, but do you pay a yearly fee? As far as I
know, Yahoo! does not allow access to their mail servers unless you pay
them--although I think some international versions do allow free access
to POP3 mail servers.

http://answers.yahoo.com/question/index?qid=20071029185456AAWGQAK

Thanks for the reply. I do pay a yearly fee, and BT Yahoo is just a UK
branded version of Yahoo (BT=British Telecom)
I can access and read my mail using Net::pOP3 by the trouble is that I
can only read my Inbox. Wit IMAP, I should be able to read other
mailboxes.
 
T

Tadeusz Bochan

Tadeusz said:
Thanks for the reply. I do pay a yearly fee, and BT Yahoo is just a UK
branded version of Yahoo (BT=British Telecom)
I can access and read my mail using Net::pOP3 by the trouble is that I
can only read my Inbox. Wit IMAP, I should be able to read other
mailboxes.

Problem solved. Move to Gmail.
Gmail has a facility to import all mail from my Yahoo account, and it
seems to be much better organized. Even the IMAP access detail is
clearly documented,
although I probably won't need it now.
Just waiting for the import to finish, then I will forward my Yahoo mail
to Gmail.
 
G

Greg Ferguson

From my own experiments with Yahoo and a lot of investigation, I found
that they only allow IMAP to mobile devices. There's a couple services
that enable that access to them, but Yahoo doesn't seem to have it
directly. They're probably sniffing some client signature or allowed
hosts that act as front-ends and refusing any that are not in their
"privileged party" list.

As others said, the Yahoo Pro service allows IMAP. For my use I couldn't
require that for users so I gave up.

gmail does have IMAP. Their IMAP is slower than using their RSS
(actually ATOM) to check the mail queue, so I suggest having a client
that makes the RSS request, then another that falls back to IMAP to
manage the queue or retrieve individual messages. Here's a jumping-off
point if you want to try the RSS "thang":

http://www.forevergeek.com/2004/10/gmail_rss_feed/

Parsing the feed is easy enough using Hpricot (and probably Nokogiri). I
don't remember if they got fancy with namespaces, which can make life
hell when dealing with arbitrary feeds, but even if they do, since
you're only interested in gmail you can work something up specific to
them easily.

It also seemed like Google's IMAP servers didn't implement the full
spec. Maybe that's because their system wasn't designed for mail storage
from day one?

Greg
 
T

Tadeusz Bochan

Hi Greg,
Thanks for all that. I will follow the details up in due course.
I managed to get imap.gmail working and using Ruby to read the messages,
though I found that Net::IMAP was a bit clumsy and daunting for me.

The other good news is that I finally found how to access the archive
tool in Yahoo:! (by accident of course!)
Here's the method for anyone who is interested:
1. Select 'Options' on the main page
2. Select 'Mail Options'
3. Select 'Filters'
4. Select 'Create or Edit filters'
5. Select 'Options' (On top rhs)
6. And Voila! There on the rhs is the option, among others, to archive!
This procedure is NOT documented in the Yahoo help, nor have I found any
other more direct way of locating this option screen.

I then saved the direct url so I don't have remember all that the next
time,
but Yahoo may fix this crazy behaviour by then.
The facility allows you to choose a folder to archive, and a date range.
It then zips all the *.eml messages and downloads them to a location of
your choosing. On extracting the files, you can read them with Outlook
(at least) or scan them with a Ruby script, which is what I need to do.
Great!
 
G

G_ F_

That's good news. Making progress is always a relief after banging our
heads against a wall.

One of the other things I ran into on Yahoo was keeping the session open
when using HTML to do things. I wrote a scraper to get my mail queue,
and used WWW::Mechanize because it automatically keeps the state info.
I'd have to periodically re-login to refresh that. I *think* they were
using a 14-day cycle, but that number could be due to exhaustion. My
brain is fried right now.
 
T

Tadeusz Bochan

Now there's a thing. I never heard of WWW::Mechanize, but there's many a
time I could have done with it. Thanks a lot for that tip, there's a
bunch of things I need to revisit now.
Btw, I'm very disappointed with Google for not having an export mail
facility, I'm usually a fan of Google and everything was looking sharp
and smart with Gmail, but I think they dropped the ball with that one.
It seems such an obvious feature to provide.

Cheers,
Tad
 
G

G_ F_

Tadeusz said:
Now there's a thing. I never heard of WWW::Mechanize, but there's many a
time I could have done with it. Thanks a lot for that tip, there's a
bunch of things I need to revisit now.
Btw, I'm very disappointed with Google for not having an export mail
facility, I'm usually a fan of Google and everything was looking sharp
and smart with Gmail, but I think they dropped the ball with that one.
It seems such an obvious feature to provide.

Well, you could write your own using Ruby and IMAP. Filtering and
searching is not as straightforward as on a regular IMAP server, but you
can create a filter in your gmail account, and then use that as a search
criteria for the IMAP session. I haven't checked, but you might be able
to tell it to use records over n days old. Or, just list the entire
contents of your inbox via Ruby and IMAP and selectively retrieve then
delete the ones you want to archive.

The RSS mechanism also supports the filters too, so if you need the
speed and can figure out a filter that does what you want, then you can
have gmail do the heavy lifting based on a RSS request, then follow it
up with the IMAP that actually transfers the messages.

And, you have to remember, Google uses gmail as an enticement. They're
putting ads in your face that are tailored to the content of your email.
I'm sure they're also gathering demographics and who knows what else
from mining the messages. Not providing archiving means you have to go
there to read the messages, even the old stuff. It also means they
continually get a better impression of who you are based on the messages
you keep vs. delete. They have no real inducement to make it easy for us
to move our mail out of their space.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top