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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Imports System.Net.Mail
Imports System.Web
Imports System.IO
Public Class Form2
Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
GroupBox1.Enabled = False
GroupBox2.Enabled = True
Button1.Enabled = True
Button2.Enabled = True
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
GroupBox2.Enabled = False
Button2.Enabled = False
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim Mail As New MailMessage
Mail.Subject = TextBox4.Text
Mail.To.Add(TextBox3.Text)
Mail.From = New MailAddress(TextBox1.Text, "Nuage du bien être")
Mail.Body = TextBox5.Text
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
SMTP.Port = "587"
If TextBox6.Text <> "" Then
Dim data = New Net.Mail.Attachment(TextBox6.Text)
Mail.Attachments.Add(data)
End If
SMTP.Send(Mail)
MsgBox("Mail envoyer !", MsgBoxStyle.Information, "Nuage_du_bien_être")
Close()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
OpenFileDialog1.Title = "Choisissez un fichier"
OpenFileDialog1.InitialDirectory = "C:\Users"
OpenFileDialog1.ShowDialog()
TextBox6.Text = OpenFileDialog1.FileName
End Sub
End Class |
Partager