你好,我的智能朋友,我有這個聯繫表格,我正在努力。我希望訪問者通過表單向我發送電子郵件。我使用godaddy作爲我的網絡託管商。從下面的代碼可以有人幫助我如何使用godaddy設置SMTP,以便我可以接收用戶在我的網站上的電子郵件?我試圖在我的本地計算機上使用它,但我不知道如何去做。 的代碼如下: 請u能形容我這行代碼:Dim mailServerName As String = "SMTP.MyDomain.com"
和SMTP服務器名稱設置
(from, "[email protected]", "feedback", body)
Imports System.Net.Mail
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
If txtComments.Text.Length > 300 Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
SendMail(txtEmail.Text, txtComments.Text)
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mailServerName As String = "SMTP.MyDomain.com"
Dim message As MailMessage = New MailMessage(from, "[email protected]", "feedback", body)
Dim mailClient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub
End Class
感謝ü非常
妳比非常有幫助 – onfire4JesusCollins 2010-11-16 19:15:02