<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Thanks for the reply</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV>> import os<BR>> os.startfile('foo.eml')</DIV></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>chrs</FONT></DIV>
<DIV><FONT face=Arial size=2>j.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=cyresse@gmail.com href="mailto:cyresse@gmail.com">Liam Clarke</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=jorge@bcs.org.uk
href="mailto:jorge@bcs.org.uk">Jorge Louis De Castro</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=tutor@python.org
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 22, 2005 12:45
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Tutor] Send
attachment</DIV>
<DIV><FONT face=Arial size=2></FONT><BR></DIV>If it's Outlook, you can use the
win32python library to control it via ActiveX/COM+<BR><BR><A
href="http://starship.python.net/crew/mhammond/">http://starship.pythonnet/crew/mhammond/</A><BR><BR>Here's
an example using VB to control Outlook - <BR><A
href="http://support.microsoft.com/?kbid=220595">http://support.microsoft.com/?kbid=220595</A><BR><BR>The
language differs, but the basic principle remains the same. <BR><BR>Create an
Application.Outlook object, and then use it's methods. <BR><BR>I know there's
a way to use the default mail client <BR>( 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. <BR><BR><BR>Good luck, and if you google how to use the
default email client, let me know!<BR><BR>Liam Clarke<BR><BR>
<DIV><SPAN class=gmail_quote>On 7/22/05, <B class=gmail_sendername>Jorge Louis
De Castro</B> <<A href="mailto:jorge@bcs.org.uk">jorge@bcs.org.uk</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any ideas how I can use Python and
the Windows API to open a PC's mail client and send an
attachment?</FONT></DIV>
<DIV><FONT face=Arial size=2>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. </FONT></DIV>
<DIV><FONT face=Arial size=2>Kinda like when we right-click on a file and
select the "send to mail recipient" behavior.</FONT></DIV>
<DIV><FONT face=Arial size=2>Been reading docs, trying out samples, and
googling this for a few days to no avail.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Cheers</FONT></DIV><SPAN class=sg>
<DIV><FONT face=Arial
size=2>jorge</FONT></DIV></SPAN><BR>_______________________________________________<BR>Tutor
maillist - <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:Tutor@python.org">Tutor@python.org</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://mail.python.org/mailman/listinfo/tutor"
target=_blank>http://mail.python.org/mailman/listinfo/tutor</A></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>