windows - 如何发送电子邮件,因为我有很多错误。谢谢
问题描述
我最近做了一个系统/注册表单。我创建了一个“子”来生成一个随机密钥。然后我想通过电子邮件发送。我创建了这段代码:
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 身份验证”等等。
怎么做才能使其具有最大的兼容性?
先感谢您
真诚的,大声的
解决方案
推荐阅读
- mysql - 在反应中,我想要两个按钮打开相同的模式,但两个按钮的操作不同
- git - 如何检查某个远程上是否存在 Git 提交?
- python - 如何在 VS Code 和 Python 中使用具有非 ASCII 字符的目录名称
- python - UnicodeDecodeError:“utf-8”编解码器无法解码位置 187 中的字节 0xa0:无效的起始字节
- android - 如何在 KOTLIN 中按下按钮时制作函数
- excel - Excel Power Query - 通过位于 Sharepoint 上的 Excel 工作表刷新
- java - 调整框架大小时,图像渲染时间过长
- sql - OBIEE 在其选择中使用不相关的事实表生成查询
- python - 如何在类或函数中使用 gpiozero.Button.when_pressed
- python - 正则表达式匹配一个函数,如果它包含一个特定的变量