Partial Class index Inherits System.Web.UI.Page Protected Sub SubmitRequest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitRequest.Click Dim send_email As Boolean Dim msg As New Net.Mail.MailMessage Dim svr As New Net.Mail.SmtpClient Dim copyaddress As String = "" Dim body_text As String send_email = True LabelNameRequired.Visible = False LabelTelephoneRequired.Visible = False LabelQueryRequired.Visible = False If (Trim(Me.NameTextBox.Text) = "") Then send_email = False LabelNameRequired.Visible = True End If If (Trim(Me.TelephoneTextBox.Text) = "") Then send_email = False LabelTelephoneRequired.Visible = True End If If (Trim(Me.QueryTextBox.Text) = "") Then send_email = False LabelQueryRequired.Visible = True End If If (send_email) Then FaultFormPanel.Visible = False FaultRecordedPanel.Visible = True 'copyaddress = "n.perry@bbpnl.com" svr.Host = System.Configuration.ConfigurationManager.AppSettings("smtp_server_address") svr.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network svr.Port = 25 msg.IsBodyHtml = False msg.To.Add("enquiries@lightingnorthamptonshire.com") 'msg.Bcc.Add("james.mcdaid@bbisl.com") If (copyaddress <> "") Then msg.Bcc.Add(copyaddress) End If msg.From = New Net.Mail.MailAddress("enquiries@lightingnorthamptonshire.com") msg.Subject = "ADDITIONAL WORKS REQUEST via Lighting Northamptonshire web site" body_text = "A new request has been submitted from the Lighting Northamptonshire web site." + vbCrLf body_text = body_text + " " + vbCrLf body_text = body_text + "The details are as follows:" + vbCrLf body_text = body_text + " " + vbCrLf If (Trim(Me.NameTextBox.Text) = "") Then body_text = body_text + "Name: Not provided" + vbCrLf Else body_text = body_text + "Name: " + Trim(Me.NameTextBox.Text) + vbCrLf End If If (Trim(Me.CompanyTextBox.Text) = "") Then body_text = body_text + "Company: Not provided" + vbCrLf Else body_text = body_text + "Company: " + Trim(Me.CompanyTextBox.Text) + vbCrLf End If If (Trim(Me.TelephoneTextBox.Text) = "") Then body_text = body_text + "Telephone: Not provided" + vbCrLf Else body_text = body_text + "Telephone: " + Trim(Me.TelephoneTextBox.Text) + vbCrLf End If If (Trim(Me.EmailTextBox.Text) = "") Then body_text = body_text + "Email: Not provided" + vbCrLf Else body_text = body_text + "Email: " + Trim(Me.EmailTextBox.Text) + vbCrLf End If body_text = body_text + "Address: " + Trim(Me.AddressTextBox.Text) + vbCrLf body_text = body_text + "Query: " + Trim(Me.QueryTextBox.Text) + vbCrLf body_text = body_text + " " + vbCrLf msg.Body = body_text svr.Send(msg) End If End Sub Protected Sub GoAddWorks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles GoAddWorks.Click Response.Redirect("addworks.aspx") End Sub End Class