win32com: need help with opening mapi session error

M

Mark Hahn

After great help from this group, I figured out what I needed to do to get
an email client to create a message and open it up on the screen with
win32com. Now I'm having trouble getting the first line of code to work
(why don't I just have you all do my project for me :)

This ...

import win32com.client
session = win32com.client.Dispatch('MAPI.Session')

.... is giving me the error ...

None: (-2147221005, 'Invalid class string', None, None)

I've also tried "Mapi.Session" and "MAPI.Session.1".

Can someone give me a hint what is going on here?
 
M

Mark Hahn

Well, seconds after posting my question, I ran into the answer in another
old posting that I swear I searched for before and didn't find:
Never mind -- this is the crash you see if you don't
have CDO object support installed for MAPI.
CDO support used to be installed by default with
Outlook, but now it isn't. After installing CDO
support, my program is happy.

So I guess I'll have to do it the hard way with all the direct MAPI crud.

Unless .... is there any way to install a microsoft feature like CDO from
Python?
 
N

News M Claveau /Hamster-P

Hi !

This run on my W2K :

import win32com.client
objEmail = win32com.client.Dispatch('CDO.Message')


#objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config
uration/sendusing") = 2

#objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config
uration/smtpserver") = "ServeurSMTP"

#objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config
uration/smtpserverport") = 25
#objEmail.Configuration.Fields.Update()

objEmail.From = "(e-mail address removed)"
objEmail.To = "(e-mail address removed)"
objEmail.Subject = "ssuujjeett"
objEmail.Textbody = "Corps (body)\ndu (of) message."
objEmail.HTMLbody = "<HTML><H3>Toto<BR>Titi<BR></H3></HTML>"
objEmail.AddAttachment("C:\\velo.jpg")
objEmail.Send()

@-salutations
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top