On Jul 20, 1:48 pm, vasudevram <[EMAIL PROTECTED]> wrote: > On Jul 20, 10:57 pm, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > I've been googling all over and can't find any good answers about this > > problem. I would like to create some kind of MAPI interface with > > Python such that when I open Microsoft Word (or another Office > > program) and click File, Send To, Mail Recipient it opens a program I > > wrote in Python and uses it to send the email rather than Outlook. > > > The closest I've come is finding the registry key HKLM\Software\Clients > > \Mail which seems to control the default email client. I did figure > > out how to redirect mailto directives on websites to my program > > successfully, but this is a whole 'nother ballgame. > > > Any suggestions are welcome. I am considering writing some VBA hooks > > in Office Apps in question, but would prefer to avoid that. > > > Thanks! > > > Mike > > > P.S. Currently using Python 2.4, wxPython 2.8.3 (for GUI) on Windows > > XP Pro. > > Hi, > > 1: I don't know much about Windows APIs, but am currently reading the > "Windows Internals" book. Got this idea from it: > > Go tohttp://www.microsoft.com/technet/sysinternals/default.mspx > and check out the SysInternals utilities there. The book says that you > can use some of them to "spy" on what an app is doing - what registry > keys it is reading/writing, lots of other OS-level calls it makes as > it runs. Digging around and using some of these utilities to check out > what an Office app does when you use it to send mail, might help you > figure out a way to do what you want. > > 2. Try looking for registry entries specific to Office Apps, and look > under those subtrees for likely email-related entries to modify (if > you haven't tried that already). I guess you already know that > fiddling with the registry can be risky and can crash your system, so > take backups, etc. > > Using COM via Python may also help - again, some digging required. You > probably already have the PyWin32 Python extensions for Windows COM > (earlier called win32all - seehttp://wiki.python.org/moin/Win32All) - > if not, its available here: > > http://www.python.org/download/releases/2.4.4/ > (scroll down the page for the link) > > Vasudev Ramwww.dancingbison.com > jugad.livejournal.com > sourceforge.net/projects/xtopdf
Thanks for the ideas...I am already monitoring the registry to see what happens when I switch between two email clients. In this case, I am switching between Outlook 2003 and Thunderbird 2. The pertinent registry files are as follows: # changes which email client to use [HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail] # obviously changes the .eml file association [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.eml] # haven't the fogiest idea what this does, if anything [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{29F458BE-8866-11D5- A3DD-00B0D0F3BAA7}] # change mailto functionality [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\DefaultIcon] @="C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe,0" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command] @="\"C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe\" -osint - compose \"%1\"" I assume you're referring to "Process Monitor", which is a really cool tool. Maybe it'll help, but I usually can't get it to filter out enough of the noise to make the output useful. I'll give it a go nonethless. I am running all my tests in a VM, so I really don't care if the registry gets hosed at this point. Thanks again, Mike -- http://mail.python.org/mailman/listinfo/python-list