$pw = import-csv D:\pw.csv
$user = "[email protected]"
$PWord = ConvertTo-SecureString –String "password" –AsPlainText -Force
$mycreds = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord
$pw | ForEach-Object {Send-MailMessage -Encoding utf8 -To $_.to -From [email protected] -Subject "Test测试" -Body ("密码是:" + $_.pw) -Credential $mycreds -SmtpServer smtp.office365.com -DeliveryNotificationOption Never -BodyAsHtml -UseSsl -port 587}
国际版的office 365