我无法使用以下脚本发送电子邮件
$fromemail = "pap@domainname.com"
$users = "pap@domainname.com"
$Server = "smptserver.domainname.com"
Send-MailMessage -From $fromemail -To $users -Subject "Disk Space Monitoring Report" -Body "Hello world" -Priority High -SmtpServer $server
这是在输出屏幕下方显示的错误消息:
Send-MailMessage : The remote name could not be resolved: 'smptserver.domainname.com' At line:10 char:2 + Send-MailMessage -From $fromemail -To $users -Subject "Disk Space Mo ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
答案 0 :(得分:0)
认为您需要将变量写为字符串,也要使用smtp服务器的ip地址而不是dns名称
SELECT DATE(SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),1,4)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),5,2)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),7,2)) AS RESULTSDATE