Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. Imports System.Net.Mail
  2.  
  3. Class Page1
  4.  
  5. Private Sub Complete_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Complete.Click
  6. Dim choice As String
  7. If (TextSubject.Text = "" Or TextName.Text = "" Or TextMessage.Text = "") Then
  8. MsgBox("Please fill in all fields.", MsgBoxStyle.Exclamation, "Attention!")
  9. Return
  10. End If
  11. If (RadioYes.IsChecked = False And RadioNo.IsChecked = False) Then
  12. MsgBox("Please check either 'Yes' or 'No'", MsgBoxStyle.Exclamation, "Attention!")
  13. Return
  14. End If
  15. If (RadioYes.IsChecked = True) Then
  16. choice = "Yes, I want the newsletter."
  17. Else
  18. choice = "No, I do not want the newsletter."
  19. End If
  20. Try
  21. Dim smtpServer As New SmtpClient()
  22. Dim message As New MailMessage()
  23. smtpServer.Credentials = New Net.NetworkCredential("phenixblaze813@aol.com", "password")
  24. smtpServer.Port = 587
  25. smtpServer.Host = "smtp.aol.com"
  26. smtpServer.EnableSsl = False
  27. message = New MailMessage()
  28. message.From = New MailAddress("phenixblaze813@aol.com")
  29. message.To.Add("phenixblaze813@aol.com")
  30. message.Subject = TextName.Text + " ##### " + TextSubject.Text
  31. message.Body = choice + " ##### " + TextMessage.Text
  32. smtpServer.Send(message)
  33. MsgBox("Form Completed!", MsgBoxStyle.Information, "Attention!")
  34. Catch ex As Exception
  35. MsgBox(ex.Message)
  36. End Try
  37. End Sub
  38. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement