Я думаю, что вы должны установить UseDefaultCredentials к истинным: см пример кода PowerShell
#SMTP server name
$smtpServer = "abcd.com.au"
$OFS = "`r`n`r`n"
#Creating a Mail object
$msg = new-object Net.Mail.MailMessage
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.UseDefaultCredentials = $true
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.UseDefaultCredentials = $true
#Email structure
$msg.From = "[email protected]"
$msg.ReplyTo = "[email protected]"
$msg.To.Add("[email protected]")
$msg.subject = "Sample Sub (" + $a + ")"
$msg.body = "This is sample mail" + $OFS
# Attach a file
$file = "C:\sample.txt"
$attachment = new-object System.Net.Mail.Attachment $file
$msg.Attachments.Add($file)
#Sending email
$smtp.Send($msg)