73 lines
2.9 KiB
Plaintext
73 lines
2.9 KiB
Plaintext
Compile function Email_Services(@Service, @Params)
|
|
/***********************************************************************************************************************
|
|
|
|
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
|
|
permission from Infineon Technologies.
|
|
|
|
Name : Email_Services
|
|
|
|
Description : Handler program for all module related services.
|
|
|
|
Notes : The generic parameters should contain all the necessary information to process the services. Often
|
|
this will be information like the data Record and Key ID.
|
|
|
|
Parameters :
|
|
Service [in] -- Name of the service being requested
|
|
Param1-10 [in/out] -- Additional request parameter holders
|
|
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
|
|
|
|
Metadata :
|
|
|
|
History : (Date, Initials, Notes)
|
|
01/08/25 djs Original programmer.
|
|
|
|
***********************************************************************************************************************/
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
$Insert APP_INSERTS
|
|
$Insert SERVICE_SETUP
|
|
$Insert REVDOTNETEQUATES
|
|
|
|
Declare subroutine Set_Property.Net, Error_Services
|
|
Declare function Environment_Services
|
|
|
|
GoToService
|
|
|
|
Return Response or ""
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// SERVICES
|
|
//-----------------------------------------------------------------------------
|
|
|
|
Service SendEmail(FromAddress, ToAddress, Subject, Body)
|
|
|
|
If ( (FromAddress NE '') and (ToAddress NE '') ) then
|
|
ErrorMessage = ''
|
|
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
|
|
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
|
|
objEmailClient = Create_Class.Net(DotNetHandle, "System.Net.Mail.SmtpClient", 0, EmailServer, 'System.String')
|
|
If Not(Get_Status(ErrorMessage)) then
|
|
rv = Send_Message.Net(objEmailClient, 'Send', objEmailMessage, 'RevDotNet', 0)
|
|
If Get_Status(ErrorMessage) then Null
|
|
Free_Class.Net(objEmailClient)
|
|
end
|
|
Free_Class.Net(objEmailMessage)
|
|
end
|
|
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)
|
|
|
|
End Service
|
|
|