471,311 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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

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. :-)



Jun 27 '08 #1
0 846

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ralph Freshour | last post: by
3 posts views Thread by Pat Deegan | last post: by
2 posts views Thread by Indy | last post: by
1 post views Thread by jake77.lucas | last post: by

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.