Re: Python To Send Emails Via Outlook Express

From: Ganesan R (rganesan_at_myrealbox.com)
Date: 12/21/04


Date: 21 Dec 2004 11:54:22 +0530


>>>>> "ian" == ian <ian@kirbyfooty.com> writes:

> Hi Ganesan,
> I'm on the verge of giving up <sigh>
> I don't suppose you could write a small script to send the email for me
> via the default windows email client.

I can see no easy way to do this. Though you can access the default mail
client using a registry key (I don't have enough win32 programming
experience to do this), there is no guarantee that the email client is a COM
server. Even Outlook Express is not a COM server. What if the user has
configured Eudora or something like that?

The best we can do is use Outlook Express settings and send the mail.

> I will then try running your script and my end to see if it works ok. I
> may have missed something and would really appreciate your help.

The final script that you pasted:

=====
import win32com.client

s = win32com.client.Dispatch('CDO.Message')
s.From = "ian@cgbs.com.au"
s.To = "ian@kirbyfooty.com"
s.Subject = "The subject"
cdoSourceOutlookExpress = 2
s.Configuration.Load(cdoSourceOutlookExpress)
s.Send()
=====

works fine for me. According to CDO.Message documentation, if IIS is
installed that configuration will be used by default, followed by OE
configuration. I don't have IIS installed, so the script picked up the OE
configuration automatically for me. Here's a variation of the above
script.

======
import win32com.client

s = win32com.client.Dispatch('CDO.Message')
c = win32com.client.Dispatch('CDO.Configuration')
cdoSourceOutlookExpress = 2
c.Load(cdoSourceOutlookExpress)
s.Configuration = c
s.From = "ian@cgbs.com.au"
s.To = "ian@kirbyfooty.com"
s.Subject = "The subject"

s.Send()
======

If that doesn't help, I give up :-(.

Ganesan



Relevant Pages

  • Add User / ConnectComputer script ... deleted existing email client, lost email?
    ... ConnectComputer script, two were successful and 2 lost their old email ... one was using Outlook XP and one ... before SP1) and were using Outlook 2000 as their email client. ... All 4 had only one external POP email account each before running the ...
    (microsoft.public.windows.server.sbs)
  • Re: Add User / ConnectComputer script ... deleted existing email client, lost email?
    ... > I haven't seen this before, but I think it's safe to say that Outlook 2000 ... >> ConnectComputer script, two were successful and 2 lost their old email ... >> mail accounts, the Exchange account added by the SBS2003 server and the ... >> book entries were copied over and the old email client was deleted. ...
    (microsoft.public.windows.server.sbs)
  • Re: Add User / ConnectComputer script ... deleted existing email client, lost email?
    ... new Outlook 2003 clients ... ... script, I think that the script should be modified to NOT delete the old ... >> book entries were copied over and the old email client was deleted. ...
    (microsoft.public.windows.server.sbs)
  • Re: Add User / ConnectComputer script ... deleted existing email client, lost email?
    ... but I think it's safe to say that Outlook 2000 ... > ConnectComputer script, two were successful and 2 lost their old email ... > accounts, the Exchange account added by the SBS2003 server and the former ... > entries were copied over and the old email client was deleted. ...
    (microsoft.public.windows.server.sbs)
  • Re: Tell a friend icon
    ... Ok Clinton, tell you what. ... When you can create a "Web Page" script that will open the email client on my computer and then fire ... The point is my software functioned and did so without> imposition with regard to spam so it can be done but it does require a> significant effort to script to implement as an actual solution. ... > "greg" wrote in message ...
    (microsoft.public.frontpage.programming)