Outlook COM: how to create a MailItem from a .msg file
Guy Lateur
guy.lateur at b-b.be
Fri Jul 8 09:37:00 EDT 2005
Yes! I finally got it to work. I've written a VBscript which I'll call from
python. It uses Outlook.Redemption's SafeMailItem. No need to use IMAP or
whatever services.
Only weird thing is it doesn't put the msg in the Inbox, as I intended, but
in the Drafts folder. Well, never mind that, it's a temp object anyway.
Here's the code:
Dim sItem, oItem
Dim myDestBox, myNS, myOL
Set myOL = CreateObject("Outlook.Application")
Set myNS = myOL.GetNamespace("MAPI")
Set sItem = CreateObject("Redemption.SafeMailItem")
Set myDestBox = myNS.GetDefaultFolder(6)
Set oItem = myDestBox.Items.Add(0)
sItem.Item = oItem
sItem.Import
"H:\Inhoud-iedereen\Inhoud-Guy\app\BBProject\data\test\Leemarchitect.msg", 3
sItem.Save
Cheers,
g
More information about the Python-list
mailing list