-
StackOverflow 文件
-
PowerShell 教程
-
傳送電子郵件
-
帶有預定義引數的 Send-MailMessage
$parameters = @{
From = 'from@bar.com'
To = 'to@bar.com'
Subject = 'Email Subject'
Attachments = @('C:\files\samplefile1.txt','C:\files\samplefile2.txt')
BCC = 'bcc@bar.com'
Body = 'Email body'
BodyAsHTML = $False
CC = 'cc@bar.com'
Credential = Get-Credential
DeliveryNotificationOption = 'onSuccess'
Encoding = 'UTF8'
Port = '25'
Priority = 'High'
SmtpServer = 'smtp.com'
UseSSL = $True
}
# Notice: Splatting requires @ instead of $ in front of variable name
Send-MailMessage @parameters