1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Imports System.Net.Mail
Dim MyMailMessage As New MailMessage()
Try
MyMailMessage.From = New MailAddress(TextBox3.Text)
ProgressBar1.Value = 0
MyMailMessage.To.Add(TextBox5.Text)
TextBox5.Text = ""
ProgressBar1.Value = 15
MyMailMessage.Subject = TextBox6.Text
MyMailMessage.Body = TextBox7.Text
TextBox7.Text = ""
ProgressBar1.Value = 30
Dim SMTP As New SmtpClient(TextBox1.Text)
TextBox1.Text = ""
ProgressBar1.Value = 50
SMTP.Port = (TextBox2.Text)
TextBox2.Text = ""
ProgressBar1.Value = 80
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential(TextBox3.Text, TextBox4.Text) '"From E-Mail Adress username and password"
TextBox3.Text = ""
TextBox4.Text = ""
ProgressBar1.Value = 90
TextBox6.Text = ""
SMTP.Send(MyMailMessage)
TextBox2.Text = ""
ProgressBar1.Value = 100
MsgBox("Message Envoyé!")
Catch ex As Exception
End Try
End Sub |
Partager