SMTPService

Refer to shipped RPG source file QRPGLRSRC and CRTDEMO program source in QCLSRC source file.

 

      *

     D ListDef1        S             60    DIM(2) CTDATA

     D ListDefSize     S             10I 0 INZ(0)

     D ListEntSize     S             10I 0 INZ(0)

     D ListCount       S             10I 0 INZ(0)

     D ListMaxCount    S             10I 0 INZ(0)

      *

     D JSMHDL          S              4    INZ(*BLANKS)

     D JSMSRV          S            100    INZ(*BLANKS)

     D JSMSTS          S             40    INZ(*BLANKS)

     D JSMMSG          S           4096    INZ(*BLANKS)

     D JSMCMD          S           2048    INZ(*BLANKS)

     D ZEROLENGTH      S             10I 0 INZ(0)

      *

     D TO              S             80A

     D FROM            S             80A

     D SUBJECT         S             80A

      *

     D LST1            DS                  OCCURS(10)

     D  TEXT                         80A

     D  CNTRL                         1A

      *

      * JSMX_BEGIN

      *

     C                   CALLB(D)  'JSMX_BEGIN'

     C                   PARM                    *OMIT

     C                   PARM                    ZEROLENGTH

      *

      * JSMX_OPEN

      *

     C                   CLEAR                   JSMSRV

     C                   EVAL      JSMSRV = 'LOCALHOST:4560'

     C                   CALLB(D)  'JSMX_OPEN'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSRV

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_LOAD

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SERVICE_LOAD' +

     C                                      ' SERVICE(SMTPMailService)' +

     C                                      ' TRACE(*YES)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SET SERVER

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SET' +

     C                                      ' SERVER(10.2.0.200)' +

     C                                      ' USER(testuser)' +

     C                                      ' PASSWORD(testuser)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SET ADDRESS

      *

     C                   EVAL      TO   = 'alick.buckley@lansa.com.au'

     C                   EVAL      FROM = 'alick.buckley@lansa.com.au'

     C                   EVAL      SUBJECT = 'Test subject'

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SET' +

     C                                      ' TO(' + TO + ')' +

     C                                      ' FROM(' + FROM + ')' +

     C                                      ' SUBJECT(' + SUBJECT + ')'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SEND - BIND LIST

      *

     C     1             OCCUR     LST1

     C                   EVAL      TEXT   = 'Line 1'

     C                   EVAL      CNTRL  = ' '

     C     2             OCCUR     LST1

     C                   EVAL      TEXT   = 'Line 2'

     C                   EVAL      CNTRL  = ' '

      *

     C                   EVAL      ListDefSize  = %SIZE(ListDef1:*ALL)

     C                   EVAL      ListEntSize  = %SIZE(LST1)

     C                   EVAL      ListCount    = 2

     C                   EVAL      ListMaxCount = %ELEM(LST1)

     C                   CALLB(D)  'JSMX_BINDLST'

     C                   PARM                    JSMHDL

     C                   PARM                    ListDef1

     C                   PARM                    ListDefSize

     C                   PARM                    LST1

     C                   PARM                    ListEntSize

     C                   PARM                    ListCount

     C                   PARM                    ListMaxCount

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SEND

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SEND'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_UNLOAD

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SERVICE_UNLOAD'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_CLOSE

      *

     C                   CALLB(D)  'JSMX_CLOSE'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_END

      *

     C                   CALLB(D)  'JSMX_END'

      *

     C                   SETON                                        LR

 

**CTDATA ListDef1

TEXT                                              A000008000

CNTRL                                             A000000100