invoke user's standard mail client

luc.saffre at gmail.com luc.saffre at gmail.com
Mon May 7 00:55:19 EDT 2007


On May 6, 10:08 am, Stefan Sonnenberg-Carstens
<stefan.sonnenb... at pythonmeister.com> wrote:
> Stefan Sonnenberg-Carstens schrieb:
>
> > Gabriel Genellina schrieb:
>
> >> En Fri, 04 May 2007 05:07:44 -0300, luc.saf... at gmail.com
> >> <luc.saf... at gmail.com> escribió:
>
> >>> the simplest way to launch the user's standard mail client from a
> >>> Python program is by creating a mailto: URL and launching the
> >>> webbrowser:
> >>> But this method is limited: you cannot specify a file to be attached
> >>> to the mail. And I guess that there would be problems if the body text
> >>> is too complex.
> >>> Does somebody know about a better method?
> >>> It should be possible at least on Windows, since Acrobat Reader is
> >>> able to do it.
>
> >> On Windows you can use MAPI.
>
> > import win32api
> > win32api.ShellExecute(0,'open','mailto:',None,None,0)
>
> For completeness
>
> import win32api
> win32api.ShellExecute(0,'open','mailto: g... at python.org',None,None,0)

That's equivalent to what the webbrowser module does in my example.
Except that your program won't work on Unix.
Luc




More information about the Python-list mailing list