added additional logging to try and capture the root cause of email service critical mona alerts

This commit is contained in:
Infineon\StieberD
2025-03-18 14:34:03 -07:00
committed by Stieber Daniel (CSC FI SPS MESLEO)
parent d5514bc3ca
commit 3d1f096f80
2 changed files with 25 additions and 15 deletions

View File

@ -41,32 +41,40 @@ Return Response or ""
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')
DotNetHandle = StartDotNet("","4.0")
DotNetDir = CheckDotNet('4.0'):'\'
MailDll = DotNetDir:'System.dll'
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
ParamTypes = 'System.String':@FM:'System.String':@FM:'System.String':@FM:'System.String'
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')
If Not(Get_Status(ErrorMessage)) then
If Not(Get_Status(ErrorCode)) then
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)
end else
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
end
Free_Class.Net(objEmailMessage)
end else
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
end
end else
ErrorMessage = 'Error in ':Service:' service. Get_Status response: ':ErrorCode
end
end else
ErrorMessage = 'Error in ':Service:' service. Null FromAddress or ToAddress passed into service.'
end
Response = (ErrorMessage EQ '')
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
Response = (ErrorMessage EQ '')
End Service