服务器响应为:即使提供了身份验证,也需要身份验证

  • 本文关键字:身份验证 响应 服务器 vb.net
  • 更新时间 :
  • 英文 :


IONOS没有帮助。尤其是突然之间,表单停止发送电子邮件。

这篇文章解释并帮助很好地使用SMTP服务器从网络表单发送电子邮件

我得到的错误是一样的:SMTP服务器需要安全连接,或者客户端没有经过身份验证。服务器响应为:需要身份验证

这是我的VB——我接受了这里的建议,使From与身份验证相同,但仍然没有运气。最初是objMM.From = New MailAddress(txtEmail.Text)。我也读到端口25可以工作,但这也不起作用。它最初是587

Sub-btSendFeedback_Click(发送方为Object,e为EventArgs(

'Create an instance of the MailMessage class
Dim objMM as New MailMessage()
'Set the properties - send the email to the person who filled out the
'feedback form.
objMM.To.Add("receiver@receiver.com")
objMM.From = New MailAddress("website@domain.co.uk")
'Send the email in text format
objMM.IsBodyHtml = False
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Subject"
'Set the body
objMM.Body = " various long boring fields here . . . "
Dim smtp As New SmtpClient()
smtp.Host = "smtp.ionos.com"
smtp.EnableSsl = True
smtp.UseDefaultCredentials = False
smtp.Credentials = New Net.NetworkCredential("website@domain.co.uk", "passwordhere")
smtp.UseDefaultCredentials = True
smtp.Port = 587
'Send method of the SmtpMail class
smtp.Send(objMM)
End Sub 

我想知道这里还有什么问题吗?IONOS确信这是一个脚本问题。

SmtpClient的精细手册。凭据上写着:

一些SMTP服务器要求在服务器代表其发送电子邮件之前对客户端进行身份验证。若要使用默认网络凭据,可以将UseDefaultCredentials设置为true,而不是设置[smtpClient.credentials]属性。如果UseDefaultCredentials属性设置为false,则在连接到服务器时,凭据将使用凭据属性中设置的值。如果UseDefaultCredentials属性设置为false,并且Credentials特性尚未设置,则邮件将匿名发送到服务器

因此,我希望您的代码只包含一个UseDefaultCredentials,以便将其设置为False。。

当然,除非您将这些凭据配置为CredentialCache中的默认凭据。。在这种情况下,在这里再次提及它们是多余的

最新更新