send mails with MS Outlook

Johannes Imhof

New Member
Hello All,

I'm new in this forum and my first question is about the interface between MS Outlook and Progress 4GL. Is it possible to call outlook from progress with a mail adress, a subject and the complete text(for example by using a com-handle). If it is can you tell my how? Is it also possible to tell outlook to send this new mail?

Best regardds and thanks for your help
Johannes
 

Chris Kelleher

Administrator
Staff member
Johannes-

Here some code that will send a mail via Outlook.

Code:
DEFINE VARIABLE oMAPI AS COM-HANDLE NO-UNDO. 
DEFINE VARIABLE oMessage AS COM-HANDLE NO-UNDO. 
DEFINE VARIABLE oRecipient AS COM-HANDLE NO-UNDO. 
DEFINE VARIABLE oAttachment AS COM-HANDLE NO-UNDO. 

CREATE "MAPI.Session" oMAPI. 

oMAPI:Logon. 

oMessage = oMAPI:Outbox:Messages:Add. 
oMessage:Subject = "Test Message with attachment". 
oMessage:Text = "Test Message". 

/* Create the recipient object */ 
oRecipient = oMessage:Recipients:Add. 
oRecipient:Name = "name@test.com". 
oRecipient:Type = 1. /* To */ 
oRecipient:Resolve. 

/* Create the attachment object and attach file */ 
oAttachment = oMessage:Attachments:Add. 
oAttachment:name = "note.txt". 
oAttachment:Type = 1. 
oAttachment:ReadFromFile("c:\note.txt"). 

/* Send the message */ 
oMessage:Update. 
oMessage:Send(Yes, No, 0). 

/* Tidy up by releasing objects */ 
RELEASE OBJECT oAttachment. 
RELEASE OBJECT oRecipient. 
RELEASE OBJECT oMessage. 
RELEASE OBJECT oMAPI.

-Chris
 
Z

Zoggy

Guest
In version 7?

Does anyone know how to do this in Version 7 with no COM?

Message imported from PEG email list
 

royc

New Member
I tried running this code, but it said "The automation server for MAPI.Session is not registered properly. Please reinstall the server or try registering it again. (5893)"

what have i forgotten to do?

thanks

Roy C.
 

jamesmc

Member
Hi All,

I don't think this option is open to users with Outlook Express as it doesn't come with the automation server that is required. I think that you can download it though from somewhere within the depths of Microsoft (if anyone has the time to look!).

You can, however, do this with Microsoft Exchange (and with any version of the full Microsoft Outlook package).

Someone correct me if I am wrong.

HTH,

James.
 
Johannes,

Please check attached file for some examples. If we have to send/receive mails via Outlook we follow this way.

Istvan
 

Attachments

  • samples.txt
    4.9 KB · Views: 154
Top