I have a working prototype and I figured I would share the two quick little EXPANDABLE scripts that I wrote. Spent (<2 hrs) on it so of course not optimized.
PowerShell Script: email.ps1
Code: Select all
[System.Net.ServicePointManager]::SecurityProtocol = 'TLS12'
$emailFolder = $args[0]
$emailID = $args[1]
$emailSubject = Get-Content -Path $emailFolder\email$emailID.txt | Select-Object -Index 0
$emailBody = Get-Content -Path $emailFolder\email$emailID.txt | Select-Object -Index 1
$sendMailParams = @{
From = 'xxxxx@mail.planning-analytics.ibmcloud.com'
To = 'youremail@domain.tld'
Subject = $emailSubject
Body = $emailBody
BodyAsHTML = $true
SMTPServer = 'mail.planning-analytics.ibmcloud.com'
Port = '587'
UseSsl = $true
Encoding = ([System.Text.Encoding]::UTF8)
}
Send-MailMessage @sendMailParams
The TI Process takes two (hopefully self-explanatory) parameters:
- pEmailSubject
- pEmailBody - Can be HTML
Code: Select all
sEmailFolder = 'S:\prod\tm1\Email';
sEmailScript = 'email.ps1';
sEmailScriptPath = Expand('%sEmailFolder%\%sEmailScript%');
sEmailID = TimSt(Now(), '\Y\m\d\h\i\s');
sEmailFile = Expand('email%sEmailID%.txt');
sEmailFilePath = Expand('%sEmailFolder%\%sEmailFile%');
DatasourceASCIIQuoteCharacter = '';
DatasourceASCIIDelimiter = ' ';
ASCIIOutput(sEmailFilePath, pEmailSubject);
ASCIIOutput(sEmailFilePath, pEmailBody);
If(FileExists(sEmailScriptPath) = 0);
ProcessError();
EndIf;
ExecuteCommand(Expand('Powershell %sEmailScriptPath% %sEmailFolder% %sEmailID%'), 0);
Good luck!