Highlighted
Super Contributor.
Super Contributor.
8630 views

Sending email to outlook with security issue, REDEMPTION installed

[Migrated content. Thread originally posted on 24 February 2011]

How can help me. A mail and the attachment(pdf) out of my invoice program is going to outlook. That works fine, but still the securty warning of outlook is comming even when I installed the develop licence of REDEMPTION.
I use a def of outlook and one of redemption.
     
       77  OUTLOOK-APP             HANDLE OF APPLICATION of OUTLOOK.
       77  OUTLOOK-MAIL            HANDLE OF MAILITEM of OUTLOOK.
       77  NAMESPACE-HANDLE        HANDLE OF NAMESPACE of OUTLOOK.
       77  CNTCTMAP-HANDLE         HANDLE OF MAPIFOLDER of OUTLOOK.
       77  INBOXMAP-HANDLE         HANDLE OF MAPIFOLDER of OUTLOOK.
       77  CONTACT-HANDLE          HANDLE OF CONTACTITEM of OUTLOOK.
       77  ATTACH-HANDLE           HANDLE OF ATTACHMENTS of OUTLOOK.
       77  REDEMPTION-MAIL-ITEM    HANDLE OF SAFEMAILITEM of REDEMPTION.

           MODIFY    OUTLOOK-APP, CREATEITEM (OLMAILITEM)
                                             GIVING  OUTLOOK-MAIL
           MODIFY    REDEMPTION-MAIL-ITEM @ITEM =
                     OUTLOOK-MAIL AS VT-DISPATCH
           MODIFY    OUTLOOK-MAIL @SUBJECT H11-ONDERWERP
           IF        HTML-OUTL
                     MODIFY    OUTLOOK-MAIL @HTMLBODY H11-BERICHT
           END-IF.
           IF        TEKST-OUTL         
                     MODIFY    OUTLOOK-MAIL @BODY H11-BERICHT
           END-IF.
           MODIFY    OUTLOOK-MAIL @TO H11-MAILNAAR
           IF        H11-BIJLAGE              NOT =  SPACES
                     INQUIRE   OUTLOOK-MAIL ATTACHMENTS IN ATTACH-HANDLE
                     MODIFY    ATTACH-HANDLE @ADD
                     (H11-BIJLAGE, OLBYVALUE, 1, "Zie bijlage")
           END-IF
           MODIFY    OUTLOOK-MAIL @SEND ()
           DESTROY   OUTLOOK-MAIL
           MOVE      1                           TO  I01
           .


What does this peace of de sourceline? : OUTLOOK-MAIL AS VT-DISPATCH
0 Likes
18 Replies
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

I have never used Redemption. Do they provide a vb og C# example on how to do this? If so, please post those lines.


What does this peace of de sourceline? : OUTLOOK-MAIL AS VT-DISPATCH


If you look at the documentation of the MODIFY verb, you will find this:

1.Use the "AS type-num" phrase in the parameter expression if you want to force the parameter to be converted to a particular VARIANT type before it is passed to a property or method of an ActiveX control or COM object. You can tell from the object's documentation and the name of the parameter whether the object expects a particular VARIANT type, such as boolean.
Use the AS phrase if the ActiveX or COM object requires a method or property parameter to be something different from the default VARIANT type chosen by the runtime for the particular COBOL data item or literal. (See section 4.3 in A Guide to Interoperating with ACUCOBOL-GT for the rules that the runtime uses to determine the VARIANT type). Specify the word "AS" followed by a numeric literal or level 78 numeric constant that indicates the variant type to which you want the parameter converted. The "activex.def" COPY file in the ACUCOBOL-GT sample/def directory contains predefined level 78 constants for each of the VARIANT types.


In short; It overrides the default runtime variant type selection. This is useful sometimes, as it happens that the published interface of a method / property may differ from the actual implementation.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Sending email to outlook with security issue, REDEMPTION installed

First I wanted you let now that I use on my office exchange, but my customer is using only outlook standalone.

I found the cobolsource lines on Acuforum(august 2008) :
http://www.acucorp.com/support/supported/customer_forum/showthread.php?t=1421&highlight=redemption


I did another search and found this code on:
http://www.outlookcode.com/d/code/getsenderaddy.htm


Function R_GetSenderAddress(objMsg)
  Dim strType
  Dim objSenderAE ' Redemption.AddressEntry
  Dim objSMail    ' Redemption.SafeMailItem
  Const PR_SENDER_ADDRTYPE = &HC1E001E
  Const PR_EMAIL = &H39FE001E

  Set objSMail = CreateObject("Redemption.SafeMailItem")
  objSMail.Item = objMsg
  strType = objSMail.Fields(PR_SENDER_ADDRTYPE)
  Set objSenderAE = objSMail.Sender
  If Not objSenderAE Is Nothing Then
    If strType = "SMTP" Then
      R_GetSenderAddress = objSenderAE.Address
    ElseIf strType = "EX" Then
      R_GetSenderAddress = objSenderAE.Fields(PR_EMAIL)
    End If
   End If

   Set objSenderAE = Nothing
   Set objSMail = Nothing
End Function

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

This is not an example of sending an email using Redemption, but to get the sender address, is that what you want?

If so, we also need to know the definition of R_GetSenderAddress.

I thought you wanted to see how to send an email? If so, this example is not what you are looking for.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Sending email to outlook with security issue, REDEMPTION installed

Indeed, I want to place an email in the outbox of outlook and the example in the Acu forum of 2008 must by, I think, the leading source. Every thing is going oke accept that outlook is placing a warning with the question if you want to accept or denie the mail.
  05 REDEMPTION-MAIL-ITEM   HANDLE OF SAFEMAILITEM OF REDEMPTION.
  05 OUTLOOK-APP                 HANDLE OF APPLICATION OF OUTLOOK.
  05 OUTLOOK-MAIL                HANDLE OF MAILITEM OF OUTLOOK.

...

CREATE SAFEMAILITEM OF REDEMPTION HANDLE IN REDEMPTION-MAIL-ITEM.
CREATE @APPLICATION OF @OUTLOOK HANDLE IN OUTLOOK-APP.
MODIFY OUTLOOK-APP @CREATEITEM(0) GIVING OUTLOOK-MAIL.
MODIFY REDEMPTION-MAIL-ITEM @ITEM = OUTLOOK-MAIL AS VT-DISPATCH

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

Every thing is going oke accept that outlook is placing a warning with the question if you want to accept or denie the mail.


Right, that is what I thought. You want to get rid of the warning. The vb example you posted does not do this.

I don't know this REDEMPTION stuff you are trying to use, and see no example of how it is supposed to accomplish the issue of the warning dialog. So I can't help you there.

A fellow user of you did in his time implement this: http://www.add-in-express.com/

He even provided example code of how to use it for the forum:


...
       01 IOutlook                  PIC X(4) COMP-N.

       78 VT-DISPATCH               VALUE 9.

       SCREEN      SECTION.
       01  TEMPLATE-SCREEN.
           03      HOutlookSM       OutlookSecurityManager
                   LINE             1
                   COL              1
                   LINES            1
                   SIZE             1
                   VISIBLE          0.

...   
           DISPLAY TEMPLATE-SCREEN.
           CREATE  Application      HANDLE IN HApplication.
           INQUIRE HApplication     @Application IN IOutlook.
           MODIFY  HOutlookSM       ConnectTo(IOutlook AS VT-DISPATCH).


Why don't you use that approach?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

I found an example I could use. Haven't tested it, but this should do the trick:

       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  .
       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
       COPY "MSOUTLOOK.DEF".
            .
       WORKING-STORAGE SECTION.
       01 HApplication              HANDLE OF APPLICATION.
       01 HMailItem                 HANDLE OF MAILITEM.
       01 objSMail                  HANDLE OF AddressEntry.

       PROCEDURE DIVISION.
       MAIN-LOGIC.

           CREATE  Application      HANDLE IN HApplication.
           CREATE  SafeMailItem     HANDLE IN objSMail.
           MODIFY  HApplication     CreateItem(0) GIVING HMailItem.
           MODIFY  objSMail         Item = hMailItem.
           MODIFY  objSMail         
                   Recipients::Add("somebody@somewhere.com")
           MODIFY  objSMail         Recipients::ResolveAll()
           MODIFY  objSMail         Subject = "Testing Redemption"
           MODIFY  objSMail         Body = "Some text"
           MODIFY  objSMail         @Send().
           DESTROY objSMail
           DESTROY HMailItem.
           DESTROY HApplication.
           STOP    RUN.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Sending email to outlook with security issue, REDEMPTION installed

First I want to thank you for all your help till now and I hope we can fixed it.

I compiled the code and I get the next errors
------------------------- Basis-routines - Debug Mode-------------------------
--------- Compiling Cheesle.cbl ----------
--------- Compile options = -o \TEST\SCHP\ACUP\@.acu -x -Cr -Di -Ga -Za
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 16: Object class name expected, @SAFEMAILITEM found
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 16: Verb expected, @SAFEMAILITEM found
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 18: Undefined data item: ITEM
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 18: Verb expected, '=' found
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 20: Undefined data item: RECIPIENTS
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 20: Verb expected, :: found
Cheesle.acu - Compilation Failure


       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  cheesle.
       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
                  COPY "OUTLOOK.DEF".
           .
       WORKING-STORAGE SECTION.
       01  HApplication              HANDLE OF APPLICATION.
       01  HMailItem                 HANDLE OF MAILITEM.
       01  objSMail                  HANDLE OF AddressEntry.
       PROCEDURE DIVISION.
       MAIN-LOGIC.

           CREATE  Application      HANDLE IN HApplication.
           CREATE  SafeMailItem     HANDLE IN objSMail.
           MODIFY  HApplication     CreateItem(0) GIVING HMailItem.
           MODIFY  objSMail         Item = hMailItem.
           MODIFY  objSMail         
                   Recipients::Add("somebody@somewhere.com")
           MODIFY  objSMail         Recipients::ResolveAll()
           MODIFY  objSMail         Subject = "Testing Redemption"
           MODIFY  objSMail         Body = "Some text"
           MODIFY  objSMail         @Send().
           DESTROY objSMail
           DESTROY HMailItem.
           DESTROY HApplication.
           STOP    RUN.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

The source example I provided was just a skeleton. You have to include the definition file for the external class (Redemption) you are using, I don't have it.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

I also noticed another glitch.

Change this:

01 objSMail                  HANDLE OF AddressEntry.

to this:

01 objSMail                  HANDLE OF SafeMailItem.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Sending email to outlook with security issue, REDEMPTION installed

Sorry for all my questions but while compiling your code I get still the next error:

------------------------- Basis-routines - Debug Mode-------------------------
--------- Compiling Cheesle.cbl ----------
--------- Compile options = -o \TEST\SCHP\ACUP\@.acu -x -Cr -Di -Ga -Za
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 21: Undefined data item: SUBJECT
C:\CS\SCOB\ACUP\ROUT\Cheesle.cbl, line 21: Verb expected, '=' found
Cheesle.acu - Compilation Failure


on the line:
           MODIFY  objSMail         Subject = "Testing Redemption"


I put in already the next source line:
                  COPY "REDEMPTION.DEF".


Cheesle how can i managed that you get my REDEMPTION.DEF?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Sending email to outlook with security issue, REDEMPTION installed

This simply means that the SafeMailItem does not have a member named subject. Check out the definition of SafeMailItem in the defintion file. It should tell you what members it has.

However, it should have. This is the example I used from their site:

dim SafeItem, oItem 
set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add "somebody@somewhere.com"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Testing Redemption"
SafeItem.Send

You may want to try this:

MODIFY objSMail Item::Subject = "A subject"
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.