project BLF > class Mail > method Connect
Description
This method connects to the Mail Server.
Parameters
icRecipients | input | character | a pipe separated list of recipients |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/mail.p)
<M-2 run IPAdressGetter (input substring(entry(1,icRecipients,'|':U),index(entry(1,icRecipients,'|':U),'@':U) + 1,-1,'CHARACTER':U) (icDomain),
output oiReturnStatus (oiReturnStatus)) in Mail>
if oiReturnStatus <> 0
then return.
assign vistep = 1.
for each tMailservers where
tMailServers.tcIP <> ""
by tMailServers.tiPreference:
CREATE SOCKET vhSocket.
vhSocket:SET-READ-RESPONSE-PROCEDURE ("readHandler":U,{&targetProcedure}).
vldummy = vhSocket:CONNECT("-S ":U + tMailServers.tcsmtpPort +
" -H ":U + tMailServers.tcIP) NO-ERROR.
do viFcCount1 = 1 to error-status:num-messages:
vcMessageList = vcMessageList + error-status:get-message(viFcCount1) + chr(10).
end.
/* debugging */
publish "Logging.BusinessCode"
("Connection to " + tMailServers.tcIP + (if vldummy then " succeeded" else " failed"), "").
if vlDummy
then return.
delete object vhSocket.
end.
<M-3 run SetMessage
(input #T-40'Mail server is not responding':100(13)T-40# (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'BLF-337':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input vcMessageList (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in Mail>
assign oiReturnstatus = -3.