invoke user's standard mail client

Tim Golden mail at timgolden.me.uk
Fri May 4 04:42:51 EDT 2007


luc.saffre at gmail.com wrote:
> 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:

[... snip code ...]

> 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.

I'm going to stick my neck out and say: I doubt
if there's one recognised, approved method. That
would require every email client to have a way
of accepting a command which said "Open up a new
email and put this, this, and this into that field,
that space, and that attachment." The only thing
I can think of which comes close is the mailto:
protocol you refer to, but according to its RFC

   http://www.faqs.org/rfcs/rfc2368.html

the only fields allowed are headers and the special
case of "body" which, as you point out, is hardly
intended for embedded attachments.

I would imagine that Acrobat must special case
known email clients and probably won't work for
some obscure client. Thunderbird, for example,
seems (haven't tried it) to allow for an attachment:

   http://www.mozilla.org/docs/command-line-args.html

Doubtless Outlook has some equivalent mechanism. After
that, you're down to looking at docs for Eudora, Pine,
etc.

TJG



More information about the Python-list mailing list