469,271 Members | 1,014 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Reading 'received' headers: Email Headers Parsing

I am a new bie experimenting with python.
I have this piece of code to parse the received
headers from emails. However, when I run with a file
as an argument it skips lines like: 1, 3, 5 etc...
I see why is this so : Its because of the
But I dont know how to fix this: I mean I dont know
how I can stay at the current one and then when I am
done with the current one I shall go to

Any hints?


import mailbox
import string
import email
import email.Utils
import time
import sys
import re

#open passed mailbox filename
fp=open(sys.argv[1], 'r')

#open mailbox from file

#getcurrent time

#iterate over mail messages

while 1:
#get next message

#exit if we have looked at the last one

if msg == None:

#get received header
received =msg.get('received')
print received
#skup messages with no received header
if received == None:

Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster

Jul 18 '05 #1
0 1586

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by NotGiven | last post: by
1 post views Thread by a c s | last post: by
29 posts views Thread by VooDoo | last post: by
1 post views Thread by Fortepianissimo | last post: by
reply views Thread by Benjamin Han | last post: by
4 posts views Thread by Ekong, Samuel Akpan | last post: by
2 posts views Thread by Jean-Marie Vaneskahian | last post: by
1 post views Thread by poopsy | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.