我正在尝试制作反馈表,但以前从未这样做过。我找到了一个在 VB 中解释它的教程,但即使代码对他有用,它似乎对我不起作用。失败后,我又尝试了另一个教程,但仍然不行!但由于第一个看起来更简单,我决定再试一次。有人可以通过向我解释我做错了什么来帮助我吗?
我有 4 个文本框Name
, Email
,Telephone
和Comments
错误似乎是由
Dim message As MailMessage = New MailMessage(from, "jaun@bulldogbroadband.co.za", "feedback", body)
错误:指定的字符串不是电子邮件地址所需的格式。
Protected Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
SendMail(txtName.Text, txtEmail.Text)
SendMail(txtTel.Text, txtComments.Text)
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mailServerName As String = "SMTP.bulldogbroadband.co.za"
Dim message As MailMessage = New MailMessage(from, "jaun@bulldogbroadband.co.za", "feedback", body)
Dim mailClient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub