Hi community, This is the task I'm struggling with: - A user sends me an email with the subject '*****3gp*****' including an attached .3gp-file. - I then fetch that email, extracts the attachement and stores it localy as a file. - I then run a python-script that parses the stored file and generates an excel-file with statistics of that file at a shared driver. I'm using getmail (http://pyropus.ca/software/getmail/) (running on cygwin with cygwin python 2.4) and the filter function provided to fetch my mail. getmail starts my filter script and the mail is send using stdin.
I then read from stdin using sys.stdin.read() and the message is stored locally. The content of this stored file is exactly the same as the mail sent to me. I then parse that message using fp = open(tmp_file,'rb') p = email.Parser.Parser() The problem I'm having is when I'm trying to extract the attachement using f=open(Filename, "wb") f.write(msg.get_payload(decode=1)) f.close() Not the whole message is decoded and stored! When only trying f.write(msg.get_payload()) I see that the last 255 bytes are missing. How is this possible, I receive every last byte from stdin? I then tried calling my windows python installation (2.4) instead of the cygwin thingie, but that didn't work either. Doing this using IDLE for windows or a cmdprompt for cygwin works great! Any ideas 'bout what I'm doing wrong here? cheers //Fredrik -- http://mail.python.org/mailman/listinfo/python-list