powershell: send-MailMessage
2023-4-18 14:24
阅读:1469
********************** Windows PowerShell 脚本开始 开始时间: 20230418134440 用户名: hello-kitty\dx RunAs 用户: hello-kitty\dx 配置名称: 计算机: hello-kitt (Microsoft Windows NT 10.0.19044.0) 主机应用程序: C:\windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe 进程 ID: 10024 PSVersion: 5.1.19041.2673 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.2673 BuildVersion: 10.0.19041.2673 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1 ********************** 已启动脚本,输出文件为 C:\Users\dx\Documents\PowerShell_transcript.hello-kitty.OEB_ec3r.20230418134440.txt PS C:\Users\dx> $Username = hello-kitt@123.dog + $Username = hello-kitt@123.dog + ~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (hello-kitt@123.dog:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException hello-kitt@123.dog : 无法将“hello-kitt@123.dog”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。 所在位置 行:1 字符: 13 + $Username = hello-kitt@123.dog + ~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (hello-kitt@123.dog:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\dx> $Username = 'hello-kitt@123.dog' PS C:\Users\dx> $password = ConvertTo-SecureString GOODDOOG -AsPlainText -Force PS C:\Users\dx> $cred = New-Object System.Management.Automation.pscredential($Username, $password) PS C:\Users\dx> $from = 'hello-kitt@123.dog' PS C:\Users\dx> $to = 'miki-mouse@123.mice' PS C:\Users\dx> $server = 'smtp.123.dog' PS C:\Users\dx> Send-MailMessage -From $from -To $to -Subject hello -Body 'hello world!' -SmtpServer $server -Credential $cred -Attachments('C:\Users\dx\Desktop\机器学习\2205.01068 Meta OPT.pdf', 'C:\Users\dx\Desktop\data\test.csv') PS C:\Users\dx> Send-MailMessage -From $from -To $from -Subject hello -Body 'hello world!' -SmtpServer $server -Credential $cred -Attachments('C:\Users\dx\Desktop\机器学习\2205.01068 Meta OPT.pdf', 'C:\Users\dx\Desktop\data\test.csv') PS C:\Users\dx> Stop-Transcript ********************** Windows PowerShell 脚本结束 结束时间: 20230418141446 **********************
转载本文请联系原作者获取授权,同时请注明本文来自郭景涛科学网博客。
链接地址:https://wap.sciencenet.cn/blog-504131-1384671.html?mobile=1
收藏
当前推荐数:0
推荐到博客首页
网友评论0 条评论