Torna al Thread

Dim destAddress As MailAddress Dim mex As MailMessage Dim attachment As Attachment Dim author As New MailAddress(indirizzoautore,"AUTORE") Try attachment = New Attachment(PathAllegato) destAddress = New MailAddress(MailDestinatario) mex = New MailMessage With mex .Subject = "Speriamo vada" .Sender = author .Body = "Se Funziona senza user password non lo so" & Chr(13) & _ "Cordiali Saluti" .From = author .ReplyTo = author .Attachments.Add(attachment) .To.Add(destAddress) .DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure End With Dim Client As New SmtpClient(TuoIPServer) ''''''''''Client.Credentials = New System.Net.NetworkCredential(user, psw) Client.Send(mex) Catch ex As InvalidOperationException MessageBox.Show("Non è stato specificato il nome Host del server") Catch ex As SmtpFailedRecipientException MessageBox.Show("Tentativo di invio al server locale, ma non è presente una mailbox") Catch ex As SmtpException MessageBox.Show("Utente non valido/Host non trovato/Altro errore in fase di invio") Catch ex As Exception MessageBox.Show(ex.ToString) End Try
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5