如何传递机器的网络凭据(domain \ machine $)来发送邮件。
我有下面的脚本但它不接受域\ Machine $,它也在寻找pwd。机器帐户具有网络凭据,并且没有密码。
$smtpClient = New-Object System.Net.Mail.SmtpClient
$smtpClient.Host = "smtpx-dc1.msn.com"
$smtpClient.Port = 25029
$smtpClient.UseDefaultCredentials = $false
$smtpClient.Credentials = New-Object System.Net.NetworkCredential("dc\AServer$")
$smtpClient.EnableSsl = $true
$message = New-Object System.Net.Mail.MailMessage
$message.From = "abc@abc.com"
$message.To.Add("abc@abc.com")
$message.Subject = "Test from Aserver"
$message.Body = "Is this working?"
$smtpClient.Send($message)
答案 0 :(得分:0)
$smtpClient = New-Object System.Net.Mail.SmtpClient
$smtpClient.Host = "smtpx-dc1.msn.com"
$smtpClient.Port = 25029
$smtpClient.UseDefaultCredentials = $true
$smtpClient.EnableSsl = $false
$message = New-Object System.Net.Mail.MailMessage
$message.From = "abc@abc.com"
$message.To.Add("abc@abc.com")
$message.Subject = "Test from Aserver"
$message.Body = "Is this working?"
$smtpClient.Send($message)