当我将以下脚本一个一个地写入powershell命令行时,它成功发送了电子邮件,但是当我运行脚本时,它返回了一堆错误。我猜在语法上需要更改某些内容才能将其作为脚本运行?有任何想法吗?
Start-Process Outlook
$o = New-Object -com Outlook.Application
$mail = $o.CreateItem(0)
#2 = high importance email header
$mail.importance = 2
$mail.subject = “Auto Build Test“
$mail.body = “This is a test“
#for multiple email, use semi-colon ; to separate
$mail.To = “myemail@company.com"
$mail.Send()
# $o.Quit()