Advertisement
Guest User

Untitled

a guest
Jul 21st, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Try
  3. Dim SmtpServer As New SmtpClient()
  4. Dim mail As New MailMessage()
  5. SmtpServer.Credentials = New Net.NetworkCredential("xxxx@gmail.com", "xxxxx")
  6. SmtpServer.Port = 587
  7. SmtpServer.Host = "smtp.gmail.com"
  8. SmtpServer.EnableSsl = True
  9. mail = New MailMessage()
  10. mail.From = New MailAddress(TextBox2.Text, "Tourism")
  11. mail.ReplyTo = New MailAddress(TextBox2.Text)
  12. mail.To.Add("xxxx@gmail.com")
  13. mail.Subject = "UTTARAKHAND TOURISM : QUICK CONTACT QUERY"
  14. mail.Body = "<B>" + "||| -- UTTARAKHAND TOURISM : QUICK CONTACT QUERY -- |||" + "</B>" + "<BR><BR><BR>" + "<B>" + "Client Name : " + "</B>" & " " & TextBox1.Text + "<BR><BR>" + "<B>" + "Email : " + "</B>" & " " & TextBox2.Text + "<BR><BR>" + "<B>" + "Mobile No. : " + "</B>" & " " & TextBox3.Text + "<BR><BR>" + "<B>" + "City : " + "</B>" & " " & TextBox4.Text + "<BR><BR>" + "<B>" + "Country : " + "</B>" & " " & DropDownList1.SelectedItem.Text + "<BR><BR>" + "<B>" + "Query Regarding : " + "</B>" & " " & TextBox6.Text + "<BR><BR>" + "<B>" + "Query : " + "</B>" & " " & TextBox7.Text + "<BR><BR>"
  15. mail.IsBodyHtml = True
  16. SmtpServer.Send(mail)
  17. Label8.Visible = True
  18.  
  19. Catch ex As Exception
  20. MsgBox(ex.ToString)
  21. End Try
  22. TextBox1.Text = ""
  23. TextBox2.Text = ""
  24. TextBox2.Text = ""
  25. TextBox3.Text = ""
  26. TextBox4.Text = ""
  27. DropDownList1.SelectedItem.Text = "Select Country"
  28. TextBox6.Text = ""
  29. TextBox7.Text = ""
  30. End Sub
  31.  
  32. Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  33. Response.Redirect(Request.Url.AbsoluteUri)
  34. End Sub
  35. End Class
  36.  
  37. Server Error in '/' Application.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement