Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IMAP support for yahoo mail

857 views
Skip to first unread message

Bijan

unread,
Sep 7, 2009, 3:08:37 AM9/7/09
to
Hi,

It is possible to access yahoo mail accounts through
imap.mail.yahoo.com. The problem is that it is necessary to send the
command:
ID ("GUID" "1")

before the LOGIN command. So to get it to work in thunderbird it would
be necessary to have thunderbird send this command.

I downloaded the source for thunderbird-2.0.0.22 and successfully
compiled it. Then I tried to add some code to get it to send that
command. I thought it would make sense to add it to the file mailnews/
imap/src/nsImapProtocol.cpp and specifically the function
nsImapProtocol::InsecureLogin(), which is where it seems the LOGIN
command is being sent.

I tried adding the following code:
IncrementCommandTagNumber();
nsCString command_guid (GetServerCommandTag());
command_guid.Append(" id (\"GUID\" \"1\")"CRLF);

nsresult rv_guid = SendData(command_guid.get(), PR_TRUE /* suppress
logging */);
if (NS_SUCCEEDED(rv_guid)){
printf("Success in sending id!\n");
}

but it doesn't seem to work. Thunderbird says something like can't
connect to server and asks for the password again. Looking at the
packets that are sent I can see that the ID command is sent. But it
seems the LOGIN command is not. Although the response to the LOGIN
command says LOGIN OK (indicating a successful login).

Anyways I tested downloading a message manually using the following
sequence of commands through "telnet imap.mail.yahoo.com 143":
1 capability
2 id ("GUID" "1")
3 login "user...@yahoo.com" "password"
4 list *
5 examine Inbox
6 fetch 1 all
7 fetch 1 body[text]
8 logout

and I was also able to get it working in mutt. I explain how to do it
on my website at:
http://www.crasseux.com/linux/

Anyways any help would be appreciated.

Best regards,
Bijan

David Bienvenu

unread,
Sep 7, 2009, 10:34:57 AM9/7/09
to
Hi Bijan,
First of all, I would not suppress logging, so then you can generate
an imap protocol log and see what the server is responding.

https://wiki.mozilla.org/MailNews:Logging

My guess is that you're not parsing the response of the command, and
confusing our parser in general, because it probably sees the response
from the ID command after sending the LOGIN command and tries to parse
it. So you need to somehow consume the response of your ID command
first, before sending the login command. Usually we use
ParseIMAPandCheckForNewMail() to parse the server response. I don't know
what the server is returning in this case, so I have no idea if our
parser as it is now will be happy with the response.

- David

Bijan Soleymani

unread,
Sep 7, 2009, 4:05:14 PM9/7/09
to
Thanks David,

I enabled imap logging and removed the code to suppress logging when
sending the id command and I also made a call to
ParseIMAPandCheckForNewMail().
Here is what the log says:
-1299633264[89925a8]: 8991978:imap.mail.yahoo.com:NA:SendData: 2 id
("GUID" "1")^M
-1299633264[89925a8]: ReadNextLine [stream=8992e54 nb=84 needmore=0]
-1299633264[89925a8]:
8991978:imap.mail.yahoo.com:NA:CreateNewLineFromSocket: * ID ("name"
"imapgate" "support-url" "http://mail.yahoo.com/" "version" "3.5.55")^M
-1299633264[89925a8]: ###!!! ASSERTION: syntax error in generic parser:
'!error', file nsIMAPGenericParser.cpp, line 92
-1299633264[89925a8]: ###!!! Break: at file nsIMAPGenericParser.cpp, line 92
-1299633264[89925a8]: 8991978:imap.mail.yahoo.com:NA:PARSER:Internal
Syntax Error on line: %s: * ID ("name" "imapgate" "support-url"
"http://mail.yahoo.com/" "version" "3.5.55")^M

So it seems thunderbird is having trouble parsing the response to the id
command which is:
* ID ("name" "imapgate" "support-url" "http://mail.yahoo.com/" "version"
"3.5.55")^M

On the positive side this is the log of the imap packets sent and
received (according to tshark):
5.111712 98.136.166.105 -> 96.20.133.9 IMAP Response: * OK IMAP4rev1
server ready (3.5.55)
5.112920 96.20.133.9 -> 98.136.166.105 IMAP Request: 1 capability
5.200712 98.136.166.105 -> 96.20.133.9 IMAP Response: * CAPABILITY
IMAP4rev1 LOGIN-REFERRALS AUTH=XYMCOOKIE AUTH=XYMCOOKIEB64 AUTH=XYMPKI
AUTH=XYMECOOKIE ID NAMESPACE
8.807688 96.20.133.9 -> 98.136.166.105 IMAP Request: 2 id ("GUID" "1")
8.896215 98.136.166.105 -> 96.20.133.9 IMAP Response: * ID ("name"
"imapgate" "support-url" "http://mail.yahoo.com/" "version" "3.5.55")
8.897354 96.20.133.9 -> 98.136.166.105 IMAP Request: 3 login
"rsole...@yahoo.com" "rosa123"
9.291807 98.136.166.105 -> 96.20.133.9 IMAP Response: 3 OK LOGIN
completed

which indicates that thunderbird is now sending the LOGIN command at least.

I will try looking into the parser and see what is wrong.

Thanks again,
Bijan

Bijan Soleymani

unread,
Sep 7, 2009, 4:33:57 PM9/7/09
to
I managed to get it to work. The problem was in:
nsImapServerResponseParser.cpp

Specifically the function:
nsImapServerResponseParser::response_data()

This is the function that figures out what the response is. It has a
switch that deals with each possible command. It didn't know about the
id command so flagged it as an error.
All I had to do was add:
case 'I':
if (toupper(fNextToken[1]) == 'D')
id_data();
else SetSyntaxError(PR_TRUE);
break;

where id_data() is a function to process the rest of the data relating
to the id command. Here is the code for that (I copied it from the one
for the language command, language_data()):
void nsImapServerResponseParser::id_data()
{
// for now, just eat the id data....
do
{
// eat each language returned to us
AdvanceToNextToken();
} while (fNextToken && !fAtEndOfLine && ContinueParse());
}

I think this would be really useful to a lot of people using yahoo mail,
because the imap access works really well. The only problem I can see is
if a lot of people start using this yahoo might block it. But I don't
think that is that likely as both freepops and YPOPs use this method to
download mail form yahoo. So yeah maybe incorporate this into
thunderbird, or make it an extension.

Thanks again,
Bijan

Bijan Soleymani

unread,
Oct 7, 2009, 12:52:34 AM10/7/09
to
I have uploaded binaries for Thunderbird 2 with yahoo IMAP support
compiled for Ubuntu (which might work on other Linux distributions) to
my site:
http://www.crasseux.com/linux/

I am now trying to compile a windows version. It should be up eventually.

There is also a binary for mutt with similar support for yahoo IMAP.

Bijan

Bijan Soleymani

unread,
Oct 7, 2009, 5:14:36 AM10/7/09
to
The windows version is now available:
http://www.crasseux.com/linux/thunderbird-2.0.0.22.en-US.win32.installer.exe

Also not only is it possible to receive mail through IMAP from
imap.mail.yahoo.com but it is also possible to send mail through SMTPs
through smtp.mail.yahoo.com. All that is necessary is to choose SSL and
port 465. You can then use your yahoo email address as username along
with your normal webmail password. This also applies to the IMAP, except
that the IMAP does not run over SSL.

Again you can read about it on my site:
http://www.crasseux.com/linux/

and it's also on wikipedia (though who knows for how long):
http://en.wikipedia.org/wiki/Yahoo!_Mail#Free_IMAP_and_SMTPs_access

I hope yahoo doesn't disable this. I mean if Gmail can offer IMAP why
not Yahoo?

Enjoy,

Dan

unread,
Oct 11, 2009, 7:08:07 AM10/11/09
to
Does TB work better with Yahoo IMAP vs Google IMAP???

on 10/6/09 11:52 PM Bijan Soleymani said the following:

Bijan Soleymani

unread,
Oct 12, 2009, 1:23:52 AM10/12/09
to
Hey Dan,

Dan wrote:
> Does TB work better with Yahoo IMAP vs Google IMAP???

No, I would say not. It probably works better with Google. Mainly
because of the following two issues with Yahoo IMAP:
1. Folders can't have subfolders on Yahoo. Although you can create
folders with a . in them, when Thunderbird requests the list of folders
the Yahoo IMAP server returns the (\HasNoChildren) flag for every
folder. I think this makes Thunderbird display them as separate folders.
I could probably check if the user is accessing Yahoo IMAP and alter
this behaviour in that case, but I don't know if that's the right thing
to do...

2. If you have lots of messages in a folder downloading headers is slow
on Yahoo. Of course this is only a problem the first time you open that
folder, because Thunderbird caches the headers, so the next time it will
only have to download the new headers. I'm assuming GMail is faster at
this, however I don't have many messages in my GMail account so I don't
know how fast it is for sure.

Bijan

djcristi

unread,
Nov 26, 2009, 7:40:45 AM11/26/09
to
On Oct 7, 11:14 am, Bijan Soleymani <bi...@psq.com> wrote:
> The windows version is now available:http://www.crasseux.com/linux/thunderbird-2.0.0.22.en-US.win32.instal...
> >>> "rsoleym...@yahoo.com" "rosa123"

can you modify and compile thunderbird 2.0.0.23 pls?

criselda...@gmail.com

unread,
May 25, 2014, 11:50:57 PM5/25/14
to
Hi my name is criselda Greig Ihave problem log in to my account of Jana.en...@yahoo.com or my old phone number is 808-469-6315 and my new number-808-397-7728 pls can you send my password so I can look up my email
0 new messages