Public Class Form1
Dim path As String
Public Sub cmdinvia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdinvia.Click
ToolStripStatusLabel2.Text = ""
Try
Dim Msg As New System.Net.Mail.MailMessage(txtmitt.Text, txtdest.Text, txtogg.Text, txtcorpo.Text)
Dim Smtp As New System.Net.Mail.SmtpClient(txtsmtp.Text)
If path <> "nada" Then
ToolStripStatusLabel2.Text = "Allego L'allegato xD"
Msg.Attachments.Add(New Net.Mail.Attachment(path))
End If
Smtp.Send(Msg)
ToolStripStatusLabel2.Text = "Inviato!"
Catch ex As Exception
ToolStripStatusLabel2.Text = "Errore! Non inviato!"
End Try
End Sub
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
path = OpenFileDialog1.FileName
Label6.Text = OpenFileDialog1.SafeFileName
End Sub
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
MsgBox("Creato da Sub0! Per pierotofy.it", MsgBoxStyle.OkOnly, "EXIT")
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
path = "nada"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
path = "nada"
Label6.Text = "Allega un file..."
End Sub
End Class