好的,所以我尝试向在文本框中输入电子邮件的用户发送电子邮件。我对我应该做什么有了一个基本的想法,但我很困惑我应该在哪里放置 CMTPClient()、凭据以及来自哪里。什么电子邮件应该去那里。我尝试输入我的电子邮件地址和凭据,但我不断收到此错误“SMTP 服务器需要安全连接或客户端未经过身份验证”。这是我的代码
Try
Dim username As String
username = TextBox1.Text
Dim SmtpServer As New SmtpClient("smtp.gmail.com")
Dim mail As New MailMessage()
SmtpServer.Credentials = New System.Net.NetworkCredential("what username goes
here", "what password goes here")
SmtpServer.Port = 587
mail = New MailMessage()
mail.From = New MailAddress("what email should i put here")
mail.To.Add(username)
mail.Subject = "Qustions"
mail.Body = "This is for testing your mother"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub