Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net.Mail
- Class Page1
- Private Sub Complete_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Complete.Click
- Dim choice As String
- If (TextSubject.Text = "" Or TextName.Text = "" Or TextMessage.Text = "") Then
- MsgBox("Please fill in all fields.", MsgBoxStyle.Exclamation, "Attention!")
- Return
- End If
- If (RadioYes.IsChecked = False And RadioNo.IsChecked = False) Then
- MsgBox("Please check either 'Yes' or 'No'", MsgBoxStyle.Exclamation, "Attention!")
- Return
- End If
- If (RadioYes.IsChecked = True) Then
- choice = "Yes, I want the newsletter."
- Else
- choice = "No, I do not want the newsletter."
- End If
- Try
- Dim smtpServer As New SmtpClient()
- Dim message As New MailMessage()
- smtpServer.Credentials = New Net.NetworkCredential("phenixblaze813@aol.com", "password")
- smtpServer.Port = 587
- smtpServer.Host = "smtp.aol.com"
- smtpServer.EnableSsl = False
- message = New MailMessage()
- message.From = New MailAddress("phenixblaze813@aol.com")
- message.To.Add("phenixblaze813@aol.com")
- message.Subject = TextName.Text + " ##### " + TextSubject.Text
- message.Body = choice + " ##### " + TextMessage.Text
- smtpServer.Send(message)
- MsgBox("Form Completed!", MsgBoxStyle.Information, "Attention!")
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement