vasudevram at gmail.com
Fri Jul 20 20:48:57 CEST 2007
On Jul 20, 10:57 pm, kyoso... at gmail.com wrote:
> 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.
> P.S. Currently using Python 2.4, wxPython 2.8.3 (for GUI) on Windows
> XP Pro.
1: I don't know much about Windows APIs, but am currently reading the
"Windows Internals" book. Got this idea from it:
Go to http://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 - see http://wiki.python.org/moin/Win32All) -
if not, its available here:
(scroll down the page for the link)
More information about the Python-list