368d6fafea
Code backup
56 lines
1.6 KiB
PowerShell
56 lines
1.6 KiB
PowerShell
##########################
|
||
# Writer: Claudio Boggian
|
||
# Company: PAL s.r.l.
|
||
#-------------------------
|
||
# Date: 2023/11/08
|
||
# v: 1.0
|
||
# Reason: Emission
|
||
#-------------------------
|
||
##########################
|
||
|
||
Write-Host("Script Start...") -ForegroundColor Yellow
|
||
|
||
# Var
|
||
$logstring = ""
|
||
$SMTPServer = “paldocker01.pal.local"
|
||
$EmailFrom = "no-reply@pal.it"
|
||
$Subject = "PAL SRL - BUONI CARBURANTE Q8"
|
||
|
||
# Code Excecution
|
||
$Elements = Import-Csv -Path ""
|
||
|
||
foreach($Element in $Elements){
|
||
$EmailTo = $Element.Mail
|
||
$FilePath1 = $Element.File
|
||
|
||
$Body = "Buongiorno,
|
||
|
||
a seguito della decisione aziendale di erogare il 'bonus benzina' secondo la possibilità data dall’art. 1 del DL n. 5 del 2023 (Decreto carburanti), con la presente invio in allegato il file pdf contenente i buoni carburante Q8.
|
||
|
||
I buoni potranno essere presentati in cassa (da smartphone o stampati) oppure utilizzati digitando il codice di 26 cifre nella colonnina del distributore self-service, selezionando la voce 'utilizza codice'.
|
||
|
||
Cordiali saluti,
|
||
PAL s.r.l."
|
||
|
||
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
|
||
|
||
$attachment1 = New-Object System.Net.Mail.Attachment($FilePath1)
|
||
$SMTPMessage.Attachments.Add($attachment1)
|
||
|
||
$SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer, 25)
|
||
|
||
$SMTPClient.Send($SMTPMessage)
|
||
|
||
LogWrite("Send mail to $EmailTo with $FilePath1")
|
||
|
||
Write-Host("Send mail to $EmailTo") -ForegroundColor Green
|
||
}
|
||
|
||
Write-Host("Script end...") -ForegroundColor Blue
|
||
|
||
Function LogWrite
|
||
{
|
||
Param ([string]$logstring)
|
||
|
||
Add-content $Logfile -value $logstring
|
||
} |