Hello,
I am writing to you following a complication of error of my script,
The goal is to send the report by email of my script, I receive errors, is that you have an idea about this error please or a script that sends the email.
Thank you a lot.
#part send email:
#$PSEmailServer = "172.20.20.1"
#send-mailmessage -to "achraf@free.fr" -from "alerte@free.fr" -subject "Test mail" -SmtpServer 172.20.20.1
param(
[string]$to,
[string]$subject,
[string]$body
)
$smtpServer = "172.20.20.1"
$smtpFrom = "achraf@free.fr"
$smtpTo = "alerte@free.fr"
$messageSubject = $subject
$messageBody = $body
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)
