project BLF > class Mail > method SendHandler

Description

This method handles the messages to be send to the mail server.


Parameters


icStringinputcharacterThis is the string send to the smtp server, this contains SMTP commands
iiNewStateinputintegerthe value of the state: to keep the sequence in which the smtp messages are sent to the smtp server.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method Mail.ReadHandler


program code (program1/mail.p)

assign viStep = iinewState.

if icstring = ?
then do:
    assign oiReturnStatus = -98.
    return.
end.

if icString = "[skip-line]":U
then assign icstring = "":U.

assign icString = icstring + chr(13) + chr(10).

set-size(vmbuffer) = 0.
SET-SIZE(vmbuffer) = LENGTH(icstring, "RAW":U) + 1.
PUT-STRING(vmbuffer,1) = icstring.
if vhSocket:WRITE(vmbuffer, 1, GET-SIZE(vmbuffer) - 1)
then oiReturnstatus = 0.

else oiReturnstatus = -98.

/* debugging */
publish "Logging.BusinessCode"
       ("packet out : ":U + icstring + "Step : ":U + string(viStep) + chr(10) + (if oiReturnStatus = 0 then "succeeded":U else "failed":U), "").

finally:
    SET-SIZE(vmbuffer) = 0.
end finally.