Outlook COM: how to create a MailItem from a .msg file
Tim Williams (gmail)
tdwdotnet at gmail.com
Mon Jul 4 12:41:46 EDT 2005
On 7/4/05, Guy Lateur <guy.lateur at b-b.be> wrote:
>
> Anything else I could try?
Lateral thinking ?
=== untested ===
import imaplib, time, sys
f = open(msg_file)
r = f.readlines()
f.close()
msg1 = ''.join(r)
server = 'my.exchangeserver.com' # or IP address
user = 'user'
pw = 'pw'
M = imaplib.IMAP4(server)
M.sock.settimeout(120)
M.login(user,pw)[1][0]
M.select()
M.append('INBOX',None ,time.time() , msg1) # Inbox or other folder name
print "MESSAGE successfully saved"
#M.close() Don't use close, deletes/purges items
M.logout()[1][0]
More information about the Python-list
mailing list