פעמים רבות אנחנו צריכים להשתמש בסקריפט בקדי לשלוח דואר אלקטרוני ניתן להשתמשי דריך משימות או כל תוכנה אחרת,
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ". C:\scriptslocation\scriptname.ps1"
PS Script to send mail: Create .ps1 file
$filename = “c:\filelocation\HtmlFIleyouwant torecieve.html”
$smtpServer = “SMTP Servername”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “sendername@domainanme”
$msg.To.Add(“recipient_address@domainanme”)
$msg.Subject = “Subject”
$msg.Body = “Body ”
$msg.Attachments.Add($att)
$smtp.Send($msg)