added additional logging to try and capture the root cause of email service critical mona alerts
This commit is contained in:
parent
d5514bc3ca
commit
3d1f096f80
@ -41,32 +41,40 @@ Return Response or ""
|
|||||||
|
|
||||||
Service SendEmail(FromAddress, ToAddress, Subject, Body)
|
Service SendEmail(FromAddress, ToAddress, Subject, Body)
|
||||||
|
|
||||||
If ( (FromAddress NE '') and (ToAddress NE '') ) then
|
|
||||||
ErrorMessage = ''
|
ErrorMessage = ''
|
||||||
|
If ( (FromAddress NE '') and (ToAddress NE '') ) then
|
||||||
|
ErrorCode = ''
|
||||||
EmailServer = Environment_Services('GetIfxEmailServer')
|
EmailServer = Environment_Services('GetIfxEmailServer')
|
||||||
DotNetHandle = StartDotNet("","4.0")
|
DotNetHandle = StartDotNet("","4.0")
|
||||||
DotNetDir = CheckDotNet('4.0'):'\'
|
DotNetDir = CheckDotNet('4.0'):'\'
|
||||||
MailDll = DotNetDir:'System.dll'
|
MailDll = DotNetDir:'System.dll'
|
||||||
Set_Property.Net(DotNetHandle, "AssemblyName", MailDll)
|
Set_Property.Net(DotNetHandle, "AssemblyName", MailDll)
|
||||||
If Not(Get_Status(ErrorMessage)) then
|
If Not(Get_Status(ErrorCode)) then
|
||||||
Params = FromAddress:@FM:ToAddress:@FM:Subject:@FM:Body
|
Params = FromAddress:@FM:ToAddress:@FM:Subject:@FM:Body
|
||||||
ParamTypes = 'System.String':@FM:'System.String':@FM:'System.String':@FM:'System.String'
|
ParamTypes = 'System.String':@FM:'System.String':@FM:'System.String':@FM:'System.String'
|
||||||
objEmailMessage = Create_Class.Net(DotNetHandle, "System.Net.Mail.MailMessage", 0, Params, ParamTypes)
|
objEmailMessage = Create_Class.Net(DotNetHandle, "System.Net.Mail.MailMessage", 0, Params, ParamTypes)
|
||||||
If Not(Get_Status(ErrorMessage)) then
|
If Not(Get_Status(ErrorCode)) then
|
||||||
objEmailClient = Create_Class.Net(DotNetHandle, "System.Net.Mail.SmtpClient", 0, EmailServer, 'System.String')
|
objEmailClient = Create_Class.Net(DotNetHandle, "System.Net.Mail.SmtpClient", 0, EmailServer, 'System.String')
|
||||||
If Not(Get_Status(ErrorMessage)) then
|
If Not(Get_Status(ErrorCode)) then
|
||||||
rv = Send_Message.Net(objEmailClient, 'Send', objEmailMessage, 'RevDotNet', 0)
|
rv = Send_Message.Net(objEmailClient, 'Send', objEmailMessage, 'RevDotNet', 0)
|
||||||
If Get_Status(ErrorMessage) then Null
|
If Get_Status(ErrorCode) then ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
|
||||||
Free_Class.Net(objEmailClient)
|
Free_Class.Net(objEmailClient)
|
||||||
|
end else
|
||||||
|
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
|
||||||
end
|
end
|
||||||
Free_Class.Net(objEmailMessage)
|
Free_Class.Net(objEmailMessage)
|
||||||
|
end else
|
||||||
|
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
|
||||||
end
|
end
|
||||||
|
end else
|
||||||
|
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
|
||||||
end
|
end
|
||||||
end else
|
end else
|
||||||
ErrorMessage = 'Error in ':Service:' service. Null FromAddress or ToAddress passed into service.'
|
ErrorMessage = 'Error in ':Service:' service. Null FromAddress or ToAddress passed into service.'
|
||||||
end
|
end
|
||||||
Response = (ErrorMessage EQ '')
|
|
||||||
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
|
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
|
||||||
|
Response = (ErrorMessage EQ '')
|
||||||
|
|
||||||
End Service
|
End Service
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
|||||||
|
|
||||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\EmailService'
|
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\EmailService'
|
||||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' EmailService.csv'
|
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' EmailService.csv'
|
||||||
Headers = 'Logging DTM' : @FM : 'Error'
|
Headers = 'Logging DTM' : @FM : 'LogData'
|
||||||
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
|
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
|
||||||
|
|
||||||
ErrTitle = 'Error in Stored Procedure "obj_Notes"'
|
ErrTitle = 'Error in Stored Procedure "obj_Notes"'
|
||||||
@ -360,14 +360,13 @@ ForwardEMail:
|
|||||||
Lock hSysLists, ServiceKeyID then
|
Lock hSysLists, ServiceKeyID then
|
||||||
rv = Set_Status(0)
|
rv = Set_Status(0)
|
||||||
RList('SELECT EMAIL_BOX BY NOTE_KEY', 5, '', '', '')
|
RList('SELECT EMAIL_BOX BY NOTE_KEY', 5, '', '', '')
|
||||||
Done = 0
|
Done = False$
|
||||||
LOOP
|
LOOP
|
||||||
ReadNext eMailBoxKey else Done = 1
|
ReadNext eMailBoxKey else Done = True$
|
||||||
UNTIL Done
|
UNTIL Done
|
||||||
mbParms = 'EMAIL_BOX':@RM:eMailBoxKey
|
mbParms = 'EMAIL_BOX':@RM:eMailBoxKey
|
||||||
eMailBoxRec = obj_Tables('ReadRec',mbParms)
|
eMailBoxRec = obj_Tables('ReadRec',mbParms)
|
||||||
If @File_Error EQ '' then
|
If @File_Error EQ '' then
|
||||||
|
|
||||||
eMailAddr = eMailBoxRec<EMAIL_BOX_EMAIL_ADDR$>
|
eMailAddr = eMailBoxRec<EMAIL_BOX_EMAIL_ADDR$>
|
||||||
eMailText = eMailBoxRec<EMAIL_BOX_EMAIL_TEXT$>
|
eMailText = eMailBoxRec<EMAIL_BOX_EMAIL_TEXT$>
|
||||||
eMailHeader = eMailBoxRec<EMAIL_BOX_EMAIL_HEADER$>
|
eMailHeader = eMailBoxRec<EMAIL_BOX_EMAIL_HEADER$>
|
||||||
@ -377,11 +376,15 @@ ForwardEMail:
|
|||||||
IF OISentFrom = 'OI_ERROR' THEN SendTo := XLATE('SEC_GROUPS', 'OI_ADMIN', 'USER', 'X')
|
IF OISentFrom = 'OI_ERROR' THEN SendTo := XLATE('SEC_GROUPS', 'OI_ADMIN', 'USER', 'X')
|
||||||
Success = Email_Services('SendEmail', SentFrom, SendTo, eMailHeader, eMailText)
|
Success = Email_Services('SendEmail', SentFrom, SendTo, eMailHeader, eMailText)
|
||||||
If Success then
|
If Success then
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDtm
|
||||||
|
LogData<2> = 'Successfully sent email From: ':SentFrom:' To: ':SendTo:' Header: ':eMailHeader:' Body: ':eMailText
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'ok')
|
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'ok')
|
||||||
end else
|
end else
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = LoggingDtm
|
LogData<1> = LoggingDtm
|
||||||
LogData<2> = Error_Services('GetMessage')
|
LogData<2> = 'Failed to send email From: ':SentFrom:' To: ':SendTo:' Header: ':eMailHeader:' Body: ':eMailText:' Error message: ':Error_Services('GetMessage')
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'critical')
|
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'critical')
|
||||||
end
|
end
|
||||||
@ -643,4 +646,3 @@ BulkCreate:
|
|||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user