Sending email from Progress using MAPI

Chris Kelleher

Administrator
Staff member
<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>DEFINE VAR objEntry AS COM-HANDLE.
DEFINE VAR objSession AS COM-HANDLE.
DEFINE VAR objMessage AS COM-HANDLE.
DEFINE VAR objRecip AS COM-HANDLE.
DEFINE VAR objAttach AS COM-HANDLE.
DEFINE VAR one AS LOGICAL INIT YES.

CREATE "MAPI.SESSION" objSession.

objSession:Logon().
objMessage = objSession:OutBox:Messages:Add().
objMessage:Subject = "How are you doing".
objMessage:Text = "Hi, this is a test".


objRecip = objMessage:Recipients:Add().
objRecip:Name = "johannm@leones.nl".
objRecip:Type = 1.
objRecip:Resolve.

ObjAttach = objMessage:Attachments:Add().
ObjAttach:Name = "testfile as an attachment".
ObjAttach:Source = "c:\config.sys".

objMessage:Update(TRUE, TRUE).
objMessage:Send(TRUE, FALSE).
objSession:Logoff.

RELEASE OBJECT objRecip.
RELEASE OBJECT objMessage.
RELEASE OBJECT objSession.

MESSAGE "End of Message" VIEW-AS ALERT-BOX.
[/code]
 

slayer

New Member
I got the following error when I run the code you distributed.
Error occurred while creating/connecting to automation server for:
Unknown error.
Error code: 0x80004005 c:\TMP\p72656r.ped (5894)

Can you point me what's wrong with my computer or the codes?
I run the codes under Win2000 server.
 

kenkc

New Member
Hi,

I'm having the same problem as slayer. Just wondering if you were able to sort it out. I'm on XP with Outlook 2002 set as my default mail program. Any ideas would be much appreciated.

Thanks.
 

cecsno

Member
kenkc said:
Hi,

I'm having the same problem as slayer. Just wondering if you were able to sort it out. I'm on XP with Outlook 2002 set as my default mail program. Any ideas would be much appreciated.

Thanks.
Possibilities

DLL is not registered.
Fix: Go to a DOS prompt and register the dll using the following syntax;

REGSVR32 [path to the DLL]


Outlook 2000 is configured with the MS Mail service or Internet Mail, and is not set as the default Microsoft Windows mail client.
Fix: From Microsoft Internet Explorer version 5.0 or later, set Outlook as your default e-mail program:

1) On the "Tools" menu, select "Internet Options"
2) On the "Programs" tab, in the "E-mail" list, select "Microsoft Outlook".
Additional Information do not choose Outlook Express, as it is not a full Mapi client.
 

franck leclair

New Member
But the problem with MAPI subsystem, that it doesn't work efficently with Nestcape 7 or Mozilla.

If you create a temporari report file (a pdf for example), and you want to delete it after the call to send the e-mail, Netscape or Mozilla doesn't find the file to send, because in the file file is already deleted !!. I've seen the same problem in severals forum, but no solution. If anybody can help me, it wil be very fine !

Example :

/* Code to create a text file */
Output to value(Session:Temp-Directory + "/temp.txt").
Put "Attached file" skip.
Output close.

/* Send the mail with MAPI (use OCX MsMapi Or dll xpMail) */
.......

Os-Delete value(Session:Temp-Directory + "/temp.txt").


NB : the delete of the file is done before that Netscape 7 Or Mozilla realize the mail.
 

jerrys

New Member
How do I get around MAPI.SESSION not registered?

Chris Schreiber said:
<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>DEFINE VAR objEntry AS COM-HANDLE.
DEFINE VAR objSession AS COM-HANDLE.
DEFINE VAR objMessage AS COM-HANDLE.
DEFINE VAR objRecip AS COM-HANDLE.
DEFINE VAR objAttach AS COM-HANDLE.
DEFINE VAR one AS LOGICAL INIT YES.

CREATE "MAPI.SESSION" objSession.

objSession:Logon().
objMessage = objSession:OutBox:Messages:Add().
objMessage:Subject = "How are you doing".
objMessage:Text = "Hi, this is a test".


objRecip = objMessage:Recipients:Add().
objRecip:Name = "johannm@leones.nl".
objRecip:Type = 1.
objRecip:Resolve.

ObjAttach = objMessage:Attachments:Add().
ObjAttach:Name = "testfile as an attachment".
ObjAttach:Source = "c:\config.sys".

objMessage:Update(TRUE, TRUE).
objMessage:Send(TRUE, FALSE).
objSession:Logoff.

RELEASE OBJECT objRecip.
RELEASE OBJECT objMessage.
RELEASE OBJECT objSession.

MESSAGE "End of Message" VIEW-AS ALERT-BOX.
[/code]
Chris - I tried this code and I get a MAPI.SESSION not registered properly. I search and found a reference to having outlook client installed for the underlying MAPI services. I installed outlook client, but I still get this message., What can I do to get around this problem?
 

mbmoser

New Member
Sending E-mail through MAPI

Has anyone found a solution to this?

I have users runnning outlook Express as the default mail client and get the following message:

The automation server for MAPI.session is not registered. Please reinstall this server xor try resgitering it again (5893).

Outlook Express is set as the efault mail application in internet Explorer.


I would be happy to register it if I knew how...

Mark Moser
 

Casper

ProgressTalk.com Moderator
Staff member
P7135:

Status: Verified
SYMPTOM(s):
Cannot use MAPI with Microsoft Outlook Express
CAUSE:
Programmatic access to, or control of the Microsoft Outlook Express
client is not supported. Simple MAPI is the only supported access to
Outlook Express messages.
FIX:
Microsoft recommends developers that desire to write custom messaging
applications use either Collaboration Data Objects (1.x), Extended
MAPI, or Microsoft Outlook Object Model. All these APIs ship with
Microsoft Outlook clients (excluding Microsoft Outlook 98 Internet
Mail Only version).


HTH,

Casper
 
Top