CIAO A TUTTI HO UN PROBLEMA VERAMENTE IDIOTA PENSO: NON RIESCO A RENDERE AUTOMATICO QUESTO EMAIL SENDER CIOè VOGLIO CHE OGNI 1 ORA SPEDISCA LA MAIL AD UN INDIRIZZO GIA IMPOSTATO SENZA CHIEDERE CONFERMA DI INVIO ECC. DEVE ESSERE TUTTO AUTOMATICO...OVVIAMENTE CI SARà L'AUSILIO DI UN TIMER CON INTERVALLO 6000 CHE OGNI ORA INVIA LA EMAIL IN AUTOMATICO... CHI PUò AIUTARMI PLEASE???:Ryuk:
P.S: USO VB.NET
P.S: USO VB.NET
Imports System.Net.Mail
Public Class mailform
Dim mail As New MailMessage()
Private Sub mailform_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
End
End Sub
Private Sub mailform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox2.Text = "*********@gmail.com"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("********@gmail.com", "********")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
Dim addr() As String = TextBox1.Text.Split(",")
Try
mail.From = New MailAddress("*********@gmail.com", "Web Developers", System.Text.Encoding.UTF8)
Dim i As Byte
For i = 0 To addr.Length - 1
mail.To.Add(addr(i))
Next
mail.Subject = TextBox3.Text
'mail.Body = TextBox4.Text
mail.Body = Form1.TextBox1.Text
If ListBox1.Items.Count <> 0 Then
For i = 0 To ListBox1.Items.Count - 1
mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i)))
Next
End If
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
mail.ReplyTo = New MailAddress(TextBox1.Text)
SmtpServer.Send(mail)
MsgBox("Messaggio Inviato", MsgBoxStyle.Information)
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
ListBox1.Items.Add(OpenFileDialog1.FileName)
End If
End Sub
End Class