Powershell Send mail by SMTP
#Powershell send mail by SMTP#
從網路上找到趕快把他記下來
如何使用 PowerShell send email
```
$daily = Get-Date -Format "yyyy/MM/dd"
$From = "TestSender@test.com"
$To = "test@test.com"
$Cc = "AThirdUser@somewhere.com"
$Attachment = "C:\users\Username\Documents\SomeTextFile.txt"
$Subject = "Subject"
$Body = "Please check attach files, file will remove $daily"
$SMTPServer = "smtp server address"
#$SMTPPort = "587"
Send-MailMessage -From $From -To $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -Attachments
```
留言
張貼留言