Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Main
- Dim thread As New Threading.Thread(AddressOf Thread_Work)
- Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
- If btnStart.Text = "Start!" Then
- thread.Start()
- btnStart.Text = "Stop and exit!"
- Else
- thread.Abort()
- Me.Close()
- End If
- End Sub
- Public Sub Thread_Work()
- Dim host As String = "smtp."
- Dim counter As Integer = 0
- Dim login As String = ""
- For i = 0 To txtEmail.Text.Length - 1
- If txtEmail.Text(i) = "@" Then
- counter = i + 1
- Exit For
- Else
- login &= txtEmail.Text(i)
- End If
- Next
- For i = counter To txtEmail.Text.Length - 1
- host &= txtEmail.Text(i)
- Next
- Dim smtp As New Net.Mail.SmtpClient(host)
- smtp.Credentials = New Net.NetworkCredential(login, txtPassword.Text)
- smtp.EnableSsl = True
- Do
- Try
- smtp.Send(txtEmail.Text, txtTarget.Text, txtSubject.Text, txtBody.Text)
- Catch err As Exception
- MsgBox(err.Message)
- End Try
- Threading.Thread.Sleep(numDuration.Value)
- Loop
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement