Resolved Help with SendEmail (progress dynamics)

progdev1

Member
Hi folks,
As part of a system error checking I am doing I need to send and email to the support team when a error occurs. Can someone help me please as regards SendEmail.
I am trying to figure out how this works and get it to work for me. I have created a program sndemail.p (below).

I am trying to get this to work. It doesn't work obviously because there is no procedure within the program called sendEmail. But I presumed that IN TARGET-PROCEDURE bit would call a procedure internal to progress. I have tried various things to get this working including looking at afsesmngrp.i, looking for other progream that call sendEmail.p, I have tried progress help and tried finding some information about this online. In all cases to no success.

I was wondering if anyone knows how to use this program and could show me an example of how to use it, or if anyone could point me in the right direction on somewhere I might be able to get better information on sendemail IN TARGET-PROCEDURE. As I'm not sure if even my first parameter is correct.
Thanks.
Code:
/* sndemail.p*/
DEFINE VARIABLE vchFailedReason AS CHAR NO-UNDO.


ASSIGN vchFailedReason = "".

RUN sendEmail IN TARGET-PROCEDURE 
                          ( INPUT "Microsoft Outlook",         /* Email profile to use  */
                            INPUT "name@test.com",  /* Comma list of Email addresses for to: box */
                            INPUT "":U,                 /* Comma list of Email addresses to cc */
                            INPUT "Test Subject",       /* Subject of message */
                            INPUT "This is a Test",     /* Message text */
                            INPUT "":U,                 /* Comma list of attachment filenames */
                            INPUT "":U,                 /* Comma list of attachment filenames with full path */
                            INPUT NOT SESSION:REMOTE,   /* YES = display dialog for modification before send */
                            INPUT 0,                    /* Importance 0 = low, 1 = medium, 2 = high */
                            INPUT NO,                   /* YES = return a read receipt */
                            INPUT NO,                   /* YES = return a delivery receipt */
                            INPUT "":U,                 /* Not used yet but could be used for additional settings */
                            OUTPUT vchFailedReason       /* If failed - the reason why, blank = it worked */
                          ).


MESSAGE vchfailedreason VIEW-AS ALERT-BOX.
 

Cringer

ProgressTalk.com Moderator
Staff member
Have you got a .p called SendEmail.p? If you do then
Code:
DEF VAR lv-Handle AS HANDLE NO-UNDO.
RUN SendEmail.p PERSISTENT SET lv-Handle.
IF VALID-HANDLE(lv-Handle) THEN 
  RUN SendEmail IN lv-Handle (...).
/*do your stuff*/
DELETE OBJECT lv-Handle.
lv-Handle = ?.
 

Osborne

Active Member
Just to be clear, the SendEmail you are referring to is the internal procedure in afsesmngrp.i which I think is part of Dynamics, and not the external one called SendEmail.p which was written by David Pipes?

I don't know anything about Dynamics, but to reference afsesmngrp.i it appears you have to have something like this:
Code:
&global-define server-side yes
{af/app/afsesmngrp.i}
I don't suppose it works if you add this into your sndemail.p?
 

Cringer

ProgressTalk.com Moderator
Staff member
Ah thanks for clarifying this Osborne. I was shooting in the dark having never done Dynamics.
 

progdev1

Member
Hi Lads,
Thanks for both your responses.
Yes the sendMail I am referring to is part of dynamics af/app/afsesmngrp.i, not what was written by David Pipes. I have tried adding the procedure directly to sndmail.p it fails to work (can't find gms_user table) and I have tried including af/app/afsesmngrp.i in sndmail.p (fails to get a connection). I am looking at using unixmail See following post http://www.progresstalk.com/threads/send-an-email-using-progress-code.114840/ to try and get things working. I'll see how I get on and post back.
 
Last edited:

progdev1

Member
Hi Guys,
I found an alternative to dynamics sendEmail. The following previous progress talk post solved my problem: http://www.progresstalk.com/threads/send-an-email-using-progress-code.114840/

I had to replace to mailx command in unixemail.p with the command below:
Code:
cemailcommand = "mailx -a 'Content-Type: text/html' -r name@test.com -s '<sub>' <list>  <<EOF":U.
.....
/* sndemail.p */ 
RUN ./unixemail.p("./TemporarySendEmailScript.sh":U,
                "Email From Unix",
                               "santa@thenorthpole.com",
                                              "Hello Santa, Hope you are well.  " ,
                                                              "").
If anyone know how the sendEmail in progress dynamics works please post a solution as well so as to assist other users.
 
Top