August 3rd, 2005, 07:26 AM
-
Saving Exchange Server attachments
Hi I have a python script that i need to run every time an e-mail is received from a certain person. I want to check if an e-mail has been received, save the attachment and then run my script. Can anyone point me in the right direction for connecting to Microsoft exhange server and saving attachments
thanks
August 3rd, 2005, 02:32 PM
-
Packet log the Microsoft Exchange Server while in progress, gather enough information, create code with the use of sockets accordingly to connect to the server and send/recv what you require.
September 27th, 2005, 07:18 AM
-
saving e-mail attachments
i know how to connect to the server and count the number of messages and get the details of a certain message if its place in the list is known. I dont know how to check for attachments on the mail and save it into a folder. can anyone let me know how i can loop through the list and look search for attachments and save the attachments.
Code:
import poplib
a = poplib.POP3('host')
a.user('username')
a.pass_('password')
(numMsgs, totalSize) = a.stat()
September 28th, 2005, 06:01 AM
-
if the attachment is a text file i can search for the filename and add all lines and create a new text file as below. However, does anybody know how i can save the attachment if it is a zip file for example
Code:
for thisNum in range(1, numMsgs + 1):
response, lines, bytes = pop.retr(thisNum)
FileLines = []
true = 0
for x in lines:
if '''filename="file.txt"''' in x:
true = 1
if true == 1:
FileLines.append(x)
if true == 1:
output = open('path\\filename.txt', 'a')
for x in FileLines:
output.writelines(x + '\n')
output.close()