Imports System.Net
Imports System.Net.Mail
Public Class Form1
Dim svr
Dim Importanza
Dim allega
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ProgressBar1.Maximum = 100
ProgressBar1.Minimum = 0
ProgressBar1.Value = 0
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
allega = InputBox("Inserisci il percorso del file da allegare")
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Public Sub SendMail()
Dim mittente = TextBox1.Text
Dim destinatario = TextBox2.Text
Dim oggetto = TextBox3.Text
Dim Testo = RichTextBox1.Text
Dim serversmtp = svr
Dim allegato = allega
Dim myMail As New MailMessage()
myMail.From = mittente
myMail.To = destinatario
myMail.Subject = oggetto
myMail.Body = "<html><body>Text</body></html>"
myMail.Priority = Importanza
Dim myAttachment As New Mail.Attachment(allegato)
myMail.Attachments.Add(myAttachment)
Dim Smtp As New SmtpClient
Smtp.Host = serversmtp
Smtp.Send(myMail)
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
svr = InputBox("Inserisci il server SMTP, se non ne conosci inserisci out.alice.it")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Timer1.Start()
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
End Sub
Public Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
Importanza = MailPriority.Low
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Importanza = MailPriority.High
End Sub
Public Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
Importanza = MailPriority.Normal
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If ProgressBar1.Value = 100 Then
Timer1.Stop()
SendMail()
Else
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
End Class