467,879 Members | 1,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

parsing IMAP responses?

According to Google, the question has come up before, but there
doesn't seem to be much of an answer.

The imaplib module return values are mostly useless as-is:
they're just whatever string the server sent (or in some cases
a list of strings). You've got to parse them using the IMAP
syntax before you can do much with them.

Is there a library somewhere that impliments the IMAP protocol
syntax?

--
Grant Edwards grante Yow! Now I understand the
at meaning of "THE MOD SQUAD"!
visi.com
Jul 18 '05 #1
  • viewed: 2723
Share:
6 Replies
Grant Edwards <gr****@visi.com> writes:
The imaplib module return values are mostly useless as-is:
they're just whatever string the server sent (or in some cases
a list of strings). You've got to parse them using the IMAP
syntax before you can do much with them.

Is there a library somewhere that impliments the IMAP protocol
syntax?


It's very messy. I don't know of one that's in distribution. I think
there's one buried inside a certain commercial product. I wrote one a
while back that is currently inaccessible (disk crash, need to get it
recovered) but it's not really useable. IMAP syntax is very very messy.
Are you trying to write an IMAP server?
Jul 18 '05 #2
On 2005-02-14, Paul Rubin <http> wrote:
Is there a library somewhere that impliments the IMAP protocol
syntax?
It's very messy.


It sure is. You'd think something intended to be
machine-readable would be easier to parse.
I don't know of one that's in distribution.
That's what I thought based on my Google results, but I thought
I'd ask.
I think there's one buried inside a certain commercial
product. I wrote one a while back that is currently
inaccessible (disk crash, need to get it recovered) but it's
not really useable. IMAP syntax is very very messy. Are you
trying to write an IMAP server?


No, I'm writing a client, and I was a bit surprised to find out
that imaplib doesn't really parse the responses at all. Since
I'm writing a client I only have to parse the responses to the
commands that I actually send, but it still a bit messy.

--
Grant Edwards grante Yow! I'm an East Side
at TYPE...
visi.com
Jul 18 '05 #3
Grant Edwards wrote:
Is there a library somewhere that impliments the IMAP protocol
syntax?


It's very messy.


It sure is. You'd think something intended to be machine-readable
would be easier to parse.


nobody knows what the IMAP protocol designers intended...

(it's not quite as bad as Netscape's Mork format, but it's pretty close)

</F>

Jul 18 '05 #4
* Grant Edwards <gr****@visi.com> in comp.lang.python:
Is there a library somewhere that impliments the IMAP protocol syntax?


Maybe the "core" part of getmail could be reused, it seems cleanly
written.
http://www.qcc.ca/~charlesc/software/getmail-4/

--
DW
Jul 18 '05 #5
On 2005-02-14, Damien Wyart <da**********@free.fr> wrote:
* Grant Edwards <gr****@visi.com> in comp.lang.python:
Is there a library somewhere that impliments the IMAP protocol syntax?


Maybe the "core" part of getmail could be reused, it seems
cleanly written.
http://www.qcc.ca/~charlesc/software/getmail-4/


Thanks -- I'll take a look.

--
Grant Edwards grante Yow! Mary Tyler Moore's
at SEVENTH HUSBAND is wearing
visi.com my DACRON TANK TOP in a
cheap hotel in HONOLULU!
Jul 18 '05 #6
[Grant Edwards]
Is there a library somewhere that impliments the IMAP protocol
syntax?

[Paul Rubin]It's very messy.

[Grant Edwards] It sure is. You'd think something intended to be
machine-readable would be easier to parse.


IMHO, email is the most disgracefully badly spec'ced "application" in
existence: I'm sure the average modern-day scr1pt k1dd13 could do better.

SMTP: Have you ever tried to bounce processing? PITA.

POP: No virtual hosting support.

IMAP: You are in a twisty maze of passages, each slightly different .....

It's no wonder the spammers can ply their trade with such ease.

grumpily-y'rs,

--
alan kennedy
------------------------------------------------------
email alan: http://xhaus.com/contact/alan
Jul 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by ian douglas | last post: by
2 posts views Thread by diablo | last post: by
reply views Thread by necroph | last post: by
reply views Thread by Kevin F | last post: by
2 posts views Thread by J Huntley Palmer | last post: by
1 post views Thread by [ Nicola ] | last post: by
1 post views Thread by buddi | last post: by
13 posts views Thread by Phillip B Oldham | last post: by
5 posts views Thread by Luis Zarrabeitia | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.