Thanks for the reply
I did try your approach at first but then, Martin
Walsh on this mailing list hinted at something way simpler and elegant, a
solution that actually adjusts itself to the default mail client of the
user.
It consists of creating an .eml file with all the
blurb that goes with it (save an email message as a draft and open it to
see what needs to go there).
Then it is a simple matter of calling
os.startfile(<filename>) and the OS will open the file with whatever
program is associated with those extensions, typically the default mail
client.
> import os > os.startfile('foo.eml')
I think it's neat, it does what I want in an
elegant way, and it keeps me from mixing languages and all that
jazz.
chrs
j.
----- Original Message -----
Sent: Friday, July 22, 2005 12:45
AM
Subject: Re: [Tutor] Send
attachment
If it's Outlook, you can use the
win32python library to control it via ActiveX/COM+
http://starship.pythonnet/crew/mhammond/
Here's
an example using VB to control Outlook - http://support.microsoft.com/?kbid=220595
The
language differs, but the basic principle remains the same.
Create an
Application.Outlook object, and then use it's methods.
I know there's
a way to use the default mail client ( as in Excel VBA's -
application.showdialog(xlDialogs.SendMail) ) but blowed if I can figure it
out. The above VBA bit automatically attaches the open spreadsheet, so unsure
if you can hijack it.
Good luck, and if you google how to use the
default email client, let me know!
Liam Clarke
On 7/22/05, Jorge Louis
De Castro <[EMAIL PROTECTED]>
wrote:
Hello,
Any ideas how I can use Python and
the Windows API to open a PC's mail client and send an
attachment?
The idea is saving some data onto a file and
then invoke the email client (OE or Outlook or whatever is the default on
the machine) with the recipient's address filled in and the file ready to be
sent as an attachment.
Kinda like when we right-click on a file and
select the "send to mail recipient" behavior.
Been reading docs, trying out samples, and
googling this for a few days to no avail.
Cheers
jorge _______________________________________________ Tutor
maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
|
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor