错误=>收到:530 5.7.1客户端未在sendmail中进行身份验证

时间:2016-09-05 08:21:20

标签: shell email authentication client sendmail

我明白了:

  

错误=>收到:530 5.7.1客户未经过身份验证

尝试通过sendmail发送电子邮件时出现此错误。与邮件服务器的连接很好,即使我可以telnet到邮件服务器。

2 个答案:

答案 0 :(得分:0)

参考此链接可能对您有所帮助。 Click这里。

答案 1 :(得分:0)

我认为您必须将UseDefaultCredentials设置为true:请参阅示例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 = "abcd@abc.com.au"
$msg.ReplyTo = "abcd@abc.com.au"
$msg.To.Add("xyz@axyz.com.au")
$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)
相关问题