Ho un errore per questo programma per inviare mail
ho provato a usare si out.alice.it che mail.gmail.com ma non funziona come mai ?
codice:
Imports System.Net
Imports System.Net.Mail
Public Class Form5
Dim openfile As New OpenFileDialog
Dim posta As New MailMessage()
Private Sub Panel1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
posta = New MailMessage
posta.From = New MailAddress(TextBox4.Text)
posta.To.Add("andrea.moro1989@gmail.com")
posta.Subject = TextBox2.Text
posta.Priority = MailPriority.High
posta.Body = RichTextBox1.Text
' If TextBox4.Text = "" Then
' Else
'posta.Attachments.Add(New Attachment(TextBox3.Text))
'End If
Dim smtp As New SmtpClient(ComboBox1.Text)
smtp.Send(posta)
MsgBox("La Mail è Stata Inviata!", MsgBoxStyle.Information, "Mail")
End Sub
Private Sub Label3_Click(sender As System.Object, e As System.EventArgs) Handles Label3.Click
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
openfile.ShowDialog()
Try
TextBox3.Text = openfile.FileName
Catch ex As Exception
End Try
End Sub
Private Sub TextBox4_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub Form5_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("out.alice.it")
ComboBox1.Items.Add("mail.gmail.com")
ComboBox1.Items.Add("out.aliceposta.it")
ComboBox1.Items.Add("smtp.teletu.it")
ComboBox1.Items.Add("smtp.net.vodafone.it")
End Sub
End Class