Trying to get SMTPMAILSERVICE working
Posted: Wed May 03, 2017 1:29 am
Hi,
Following an example and your documentation, I'm not able to send an Email through this service.
Does something need to be running in the background on our iSeries?
I tried both the iSeries IP address and our Mail router ip addess, still no luck.
It appears each BIF runs okay except for the last unload - 'SERVICE_UNLOAD' where it says the "Invalid JSMX handle"
Here are my values I'm sending back in the Service Module.
"STAGE":{"type":{"t":"A","l":20},"value":"unload"},"JSMCMDX":{"type":{"t":"H","l":512},"value":"SERVICE_UNLOAD"},"JSMSTS":{"type":{"t":"A","l":20},"value":"ERROR"},"JSMMSG":{"type":{"t":"A","l":256},"value":"(0992) - Invalid JSMX handle."}}}}
My is my code
Following an example and your documentation, I'm not able to send an Email through this service.
Does something need to be running in the background on our iSeries?
I tried both the iSeries IP address and our Mail router ip addess, still no luck.
It appears each BIF runs okay except for the last unload - 'SERVICE_UNLOAD' where it says the "Invalid JSMX handle"
Here are my values I'm sending back in the Service Module.
"STAGE":{"type":{"t":"A","l":20},"value":"unload"},"JSMCMDX":{"type":{"t":"H","l":512},"value":"SERVICE_UNLOAD"},"JSMSTS":{"type":{"t":"A","l":20},"value":"ERROR"},"JSMMSG":{"type":{"t":"A","l":256},"value":"(0992) - Invalid JSMX handle."}}}}
My is my code
Code: Select all
* OPEN Service and get Handler
Use Builtin(JSMX_OPEN) To_Get(#JSMSTS #JSMMSG #JSMHDLX)
Execute Subroutine(Check_Sts) With_Parms(#JSMSTS #JSMMSG)
#stage := 'open'
If Cond('#JSMSTS *NE OK')
#JSMCMDX := 'SERVICE_LOAD SERVICE(SMTPMAILSERVICE)'
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDLX #JSMCMDX) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(Check_Sts) With_Parms(#JSMSTS #JSMMSG)
#stage := 'service'
Endif
If Cond('#JSMSTS *NE OK')
#JSMCMDX := 'SET SERVER(172.20.50.25) TO([email protected]) from([email protected]) from_name(Glynn)'
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDLX #JSMCMDX) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(Check_Sts) With_Parms(#JSMSTS #JSMMSG)
#stage := 'set server'
Endif
If Cond('#JSMSTS *NE OK')
#JSMCMDX := 'SEND SUBJECT(SMTPMAILSERVICE Test)'
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDLX #JSMCMDX) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(Check_Sts) With_Parms(#JSMSTS #JSMMSG)
#stage := 'send'
Endif
If Cond('#JSMSTS *NE OK')
#JSMCMDX := 'SERVICE_UNLOAD'
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDLX #JSMCMDX) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(Check_Sts) With_Parms(#JSMSTS #JSMMSG)
#stage := 'unload'
Endif
Endroutine
Subroutine Name(Check_Sts) Parms((#JSMSTS *RECEIVED) (#JSMMSG *RECEIVED))
If Cond('#JSMSTS *NE OK')
* Close service and Exit Program
Use Builtin(JSMX_CLOSE) With_Args(#JSMHDLX) To_Get(#JSMSTS #JSMMSG)
Endif
Endroutine