$user = "lang.wang@slbcopower.com" $PWord = ConvertTo-SecureString –String "这里是密码" –AsPlainText -Force $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord #Start-Sleep -Seconds 120 #这是暂停多久之后执行 $body=Get-Content "d:\log.txt" #这是从D盘内的log.txt获取里面的内容 Send-MailMessage -Subject "test" -Body $body -From $user -to 973447211@qq.com -SmtpServer smtp.263.net -Port 465 -UseSsl -Credential $user #Stop-Computer #这是关机
本文链接: https://www.pstips.net/powershell-send-mail-completed.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
-Credential $user
是不应该替换成
-Credential $Credential
还是我理解错了