[Tutor] Exchange Public Folders
Michael Montagne
Michael Montagne <montagne@boora.com>
Thu Jul 3 13:00:02 2003
Hey!! There's no message with that code!! Sorry bout that.What is
supposed to happen is that all the items from the FAX user's inbox are
going to be moved to a Public Folder called 'FAX INBOX'. I am running
this from a Linux box so I don't have access to any of the win32
extensions, although I could if I must.
I can effectively iterate through the messages but they won't copy. I'm
sure the rights are OK. I can also effectively iterate the 'Public
folders/FAX INBOX' folder. Is this even possible to do?
>Displaying tremendous intelligence on 02/07/03, Michael Montagne wrote:
> #!/bin/python
>
> import getpass, imaplib
> from mx.DateTime import *
> import smtplib
> cnt=0
> host="webmail"
> address="montagne@boora.com"
> faddress="fax@boora.com"
> msg="Subject: Incoming Fax"
>
>
> M = imaplib.IMAP4('mailserver')
> M.login('FAX', 'faxpass')
> cnt=M.select('INBOX')
> print cnt
> #print M.list()
> typ, data = M.search(None, 'ALL')
>
>
> for num in data[0].split():
> typ, data = M.fetch(num, '(RFC822)')
> M.append("Public Folders/FAX INBOX",None,None,num)
> M.copy(num,"Public Folders/FAX INBOX")
> # M.store(num,'+FLAGS','\Deleted')
> print ('%s' % (num))
> #M.expunge()
> M.logout()
> if cnt:
> msg="Subject: Incoming Fax\n\n" + cnt[1][0] + " faxes just arrived"
> s=smtplib.SMTP(host)
> s.sendmail(faddress,address,msg)
--
Michael Montagne http://www.themontagnes.com 503.226.1575
--