By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,050 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,050 IT Pros & Developers. It's quick & easy.

Re: [Fwd: Re: How to make one program connect to more than one TCP?]

P: n/a
ag**@cs.its.ac.id wrote:
i want to make one program that the steps like this:
1. download email from email account, for example: ag**@yahoo.com, saved
in a file, for example: downloadedEmail.txt
Can be done via the standard imaplib module. No need to use twisted.
2. parsing the downloadedEmail.txt, get the sender, subject and the
message.if there is attachmet/s, not be taken.
Save it as an eml file. Use the standard email.Parser module for
extracting headers.
3. posting the downloadedEmail.txt that has been parsed into nntp server.
4. open nntp client for example 'thunderbird' to acces your nntp server.
I have no clue about it.
i attach my programs to u..
it is very important for me as final project in my study class, too
difficult for me....thanks for your help!!!
Well, I can send you some examples that show how to download and parse
emails from imap server. I have never used nntp before so....
Some examples are attached, and also a code fragment:

IMAPDate.py - to convert between IMAP and datetime.date
imaputils.py - to show how to connect to IMAP server and list folders on
it (you need to create your own local.py file...), also shows how to
append a new message to a folder on the imap server.
code_fragment.py - to show how to search for messages on the server and
download them as pure data string, it is NOT a complete program!

And finally, here is how you parse and email:

import email.Parser
email_data = file('test2.eml','rb').read()
parser = email.Parser.Parser()

Then you need to example "parser" and its methods.

Anyway, it is your homework, I don't think that I'm going to give more
help unless you have a specific question. :-)

Best,

Laszlo

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.