473,385 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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
6 2955
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ian douglas | last post by:
I have an mbox mailbox on a linux server that I need to open and parse, message by message, looking for content via PHP. However, for whatever reason, my hosting provider has not compiled PHP with...
2
by: diablo | last post by:
Hello , I have a file that contains the following data (example) and does NOT have any line feeds: 11 22 33 44 55 66 77 88 99 00 aa bb cc dd ....to 128th...
0
by: necroph | last post by:
Hello everybody, i am using an imap-component to read e-mails from an exchange-Server. This is allready done. My problem is that the content of that mails looks confusing. My first try was just...
0
by: Kevin F | last post by:
Sorry to repost... but 4am didn't get much responses. I've been trying to implement this script, it polls an IMAP inbox for unread messages and displays the sender and subject in a scrollable...
2
by: J Huntley Palmer | last post by:
I am having a horrific time integrating uw-imap's c-client for imap support in php. The problem is a whole bunch of "Text relocation remains referenced against symbol" errors during linking....
1
by: [ Nicola ] | last post by:
Using imap i must zap through emails in my email address, then saving part of the message (the main body that is). Question is, how am i supposed to read only the message's content, ignoring all...
1
by: buddi | last post by:
Hi I want to write a Server program in java that "behaves like" an IMAP Server. All I need is 1. It has to wait a designated port to accept connection (it need not be a multi-client server)...
13
by: Phillip B Oldham | last post by:
Is there a standard library for parsing emails that can cope with the different way email clients quote?
5
by: Luis Zarrabeitia | last post by:
I need to parse a file, text file. The format is something like that: TYPE1 metadata data line 1 data line 2 .... data line N TYPE2 metadata data line 1 ....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.