On Wed, Apr 02, 2008 at 10:20:41AM +, linuxian iandsd wrote:
> well, here is a piece of final script :
>
> #!/usr/bin/python
> #
>
> import sys
>
> b=[]
> while 1:
> data = sys.stdin.readline()
> if data != '\n':
> b.append(data)
> else:
> break
I'd keep working on that loop a bit in
well, here is a piece of final script :
#!/usr/bin/python
#
import sys
b=[]
while 1:
data = sys.stdin.readline()
if data != '\n':
b.append(data)
else:
break
for i in (0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16):
b[i]=b[i].split(':')[1].strip()
#print b[i]
b[1]=b[1].split(':')
b[1]=b[1][1]
linuxian iandsd wrote:
> well, i don't know how to pipe the file to my script !!
It's how procmail works. Presuming you looked up how to write
a procmail rule to save the body of your mail into a file, you
should also see right next to it the instructions for piping
the message to a program. (It
linuxian iandsd wrote:
> ok - as i mentioned in my first email i use procmail to put THE BODY of all
> incoming mail into a file (that is one per incoming email as i use the
> variable $date-$time in the name).
>
> now this file can contain only one email but it can also contain 2 or more
> (this
ok - as i mentioned in my first email i use procmail to put THE BODY of all
incoming mail into a file (that is one per incoming email as i use the
variable $date-$time in the name).
now this file can contain only one email but it can also contain 2 or more
(this happens if for example there is a d
On Tue, Apr 01, 2008 at 09:07:04PM +, linuxian iandsd wrote:
> a=open('/home/john/data/file_input.tmp', 'r')
> b=open('/home/john/data/file_output', 'w')
This is collecting mail as it comes in? If you have a mail
rule in place to dump mail into this file_input.tmp file,
you could run into tro
well, my script is so simple ! nothing complicated
#!/usr/bin/python
#
import re, sys
a=open('/home/john/data/file_input.tmp', 'r')
b=open('/home/john/data/file_output', 'w')
aa=a.readlines()
n=0
for L in aa:
# I split every line because i only need what's after the ":"
# the email comes in the
The email and mailbox modules might help you out. Multiple email messages
will probably parse as an mbox format mailbox.
http://docs.python.org/lib/module-email.html
http://docs.python.org/lib/module-mailbox.html
Cheers
On Friday 28 March 2008 03:14, linuxian iandsd wrote:
> good morning ever
linuxian iandsd wrote:
> but sometimes two or more emails come in at once so the input file that
> my python script has to parse is more than five lines !! my question is
> how do i effeciently manage this from within my original script.
I guess you need to put your processing into a loop?
Ken
good morning everybody !
I have scripted a small program to parse a 5 lines email message as it comes
in to my inbox (this is handled by procmail & here is a wonderful intro to
it : http://linuxfocus.org/English/November1997/article8.html)
so every email is being parsed & information is extracted
10 matches
Mail list logo