Python To Send Emails Via Outlook Express

Lenard Lindstrom len-1 at telus.net
Tue Dec 21 22:06:03 CET 2004


Steve Holden <steve at holdenweb.com> writes:

> ian at kirbyfooty.com wrote:
> 
> > Hi Fredrik,
> > Thank you for the suggestion.
> > I tried different from/to settings and guess what? The mail came
> > thru.
> > The script is now..
> > import win32com.client
> > s = win32com.client.Dispatch('CDO.Message')
> > s.From = "ian at cgbs.com.au"                                (was
> > "ian at kirbyfooty.com")
> > s.To = "ian at kirbyfooty.com"                                  (was
> > "someone at yahoo.com")
> > s.Subject = "The subject"
> > s.Send()
> > My problem is thought, the message is still not being sent via
> > Outlook
> > Express.
> > What am I missing?
> > Thanks again for your help so far!!
> > Kind regards
> > Ian
> >
> Unfortunately Outlook Express isn't programmable in the same way as
> Outlook. I used to use it because this property gave it a certain
> degree of immunity from macro viruses (back in the days when Outlook
> came configured to open any Office document it came across).
> 
Outlook Express can be accessed through the Simple Mapi interface -
at least the version on Win98 can. I have a program that reads
and deletes messages from the new mail folder. So I would imaging
mail can be also sent through Outlook Express using Simple Mapi,
but I have not tried it. I have also not tried using Simple Mapi
under Python, only VC++. But a quick test shows I can access
MAPI32.DLL use the ctypes package:

import ctypes
mapi = ctypes.windll.mapi32
MAPILogon = mapi.MAPILogon
...

It is messy though.

Lenard Lindstrom
<len-l at telus.net>




More information about the Python-list mailing list