首页 > 解决方案 > 如何发送电子邮件,因为我有很多错误。谢谢

问题描述

我最近做了一个系统/注册表单。我创建了一个“子”来生成一个随机密钥。然后我想通过电子邮件发送。我创建了这段代码:

    SerSMTP()
    Dim SrvSMTP As String = Serv.Text

    Dim MessageText As String = "Test 1212! Good!"

    Try
        Dim MyMailMessage As New MailMessage()
        Dim SMTPServer As New SmtpClient("smtp-mail.outlook.com")

        MyMailMessage.From = New MailAddress("regikey@hotmail.com")
        MyMailMessage.To.Add(Adress.Text)
        MyMailMessage.Subject = ("Registration")
        MyMailMessage.Body = ("Your key is " & GenKey)

        SMTPServer.Port = ("993") 'Port
        SMTPServer.Credentials = New System.Net.NetworkCredential("regikey@hotmail.com", "Idontwanttoshowthepasswordsorry!")
        SMTPServer.EnableSsl = True

        SMTPServer.Send(MyMailMessage) 'Send
    Catch ex As Exception
        MsgBox("Unable to send to email. Reason :" & ex.ToString)
    End Try

但是我收到了一批错误,例如:“SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应为:需要 5.7.0 身份验证”等等。

怎么做才能使其具有最大的兼容性?

先感谢您

真诚的,大声的

标签: windowsvb.netemail

解决方案


推荐阅读