Automatic Emails

I know that there have been a lot of discussions about how to send emails via Progress but one of our clients needs the facility to do this from Progress 8.3b (character Client) under Windows NT.

They have a table containing the email addresses and associated messages; what they want is the facility to automatically send out these emails without any operator intervention. They use outlook express.



I have looked at the ShellExecute examples but they need some form of operator intervention to send/close.

Any help gratefully accepted.

:confused:
 

dkellgren

Member
Try this out Mike. I ripped it from some existing code, so their may be some extra code you don't need, but I think this will get you what you want.

DO WITH FRAME {&FRAME-NAME}:


/* Parameters Definitions --- */
DEF VAR logon-name AS CHAR NO-UNDO.
DEF VAR recip-name AS CHAR NO-UNDO.
DEF VAR subject AS CHAR NO-UNDO .
DEF VAR priority AS CHAR NO-UNDO.
DEF VAR message-text AS CHAR NO-UNDO.


ASSIGN
recip-name = "dkellgren@aimntls.com"
message-text = "Auto Email Test"
subject = "Just Testing"
logon-name = "kellgren".


/* Local Variable Definitions --- */
DEF VAR chSession AS COM-HANDLE.
DEF VAR chMessage AS COM-HANDLE.
DEF VAR chRecipient AS COM-HANDLE.
DEF VAR chAttachment AS COM-HANDLE.
DEF VAR chFiles AS COM-HANDLE.

CREATE "MAPI.session" chSession.
IF logon-name = "" THEN
chSession:logon NO-ERROR.
ELSE
chSession:logon(logon-name, No, Yes, 0) NO-ERROR.

chMessage = chSession:eek:utbox:messages:add NO-ERROR.
chMessage:Subject = subject NO-ERROR.
chMessage:Type = "IPM.Note" NO-ERROR.
chMessage:Text = message-text NO-ERROR.
chMessage:Importance = IF priority = "Low" THEN 0
ELSE IF priority = "High" THEN 2
ELSE 1 NO-ERROR.

/* Create one Recipient */
chRecipient = chMessage:Recipients:Add NO-ERROR.
chRecipient:name = recip-name NO-ERROR.
chRecipient:Type = 1 NO-ERROR.
chRecipient:resolve NO-ERROR.


ASSIGN chMessage:TEXT = chMessage:TEXT + CHR(10).

/* Save and send message */
chMessage:Update NO-ERROR.
chMessage:send(Yes, No, 0) NO-ERROR.

release object chAttachment NO-ERROR.
release object chRecipient NO-ERROR.
release object chMessage NO-ERROR.
release object chSession NO-ERROR.

END.
 
I must be doing something wrong.

I've changed the recip-name, logon-name (as "") and run the program but nothing seems to happen.

Have I missed something??
 
Top