Fabio7586
19-08-2010, 13:40
Salve, stavo tentando di costruire un piccolo cliente email, e ho fatto questo codice, ma non funziona:
Imports System.Net
Imports System.Net.Mail
Imports System.Net.Sockets.NetworkStream
Imports System.Net.Sockets.TcpClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim msg As New System.Net.Mail.MailMessage
msg.DeliveryNotificationOptions = Net.Mail.DeliveryNotificationOptions.OnFailure
msg.Subject = "email vb"
msg.IsBodyHtml = True
msg.Body = "email vb"
msg.Bcc.Add("[email protected]")
msg.From = New System.Net.Mail.MailAddress("[email protected]")
Dim client As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.Credentials = New System.Net.NetworkCredential("[email protected]", "password", "WWW.GOOGLE.COM")
client.Send(msg)
End Sub
End Class
mi restituisce un errore nel quale viene richiesta l'autenticazione con il server.
Della parte in grassetto, ho provato ad inserire la user e la password senza autenticazione sicura, non restituisce nessun errore, ma la mail non la invia..
Mi aiutate a capire come devo fare a farlo funzionare?
Imports System.Net
Imports System.Net.Mail
Imports System.Net.Sockets.NetworkStream
Imports System.Net.Sockets.TcpClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim msg As New System.Net.Mail.MailMessage
msg.DeliveryNotificationOptions = Net.Mail.DeliveryNotificationOptions.OnFailure
msg.Subject = "email vb"
msg.IsBodyHtml = True
msg.Body = "email vb"
msg.Bcc.Add("[email protected]")
msg.From = New System.Net.Mail.MailAddress("[email protected]")
Dim client As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.Credentials = New System.Net.NetworkCredential("[email protected]", "password", "WWW.GOOGLE.COM")
client.Send(msg)
End Sub
End Class
mi restituisce un errore nel quale viene richiesta l'autenticazione con il server.
Della parte in grassetto, ho provato ad inserire la user e la password senza autenticazione sicura, non restituisce nessun errore, ma la mail non la invia..
Mi aiutate a capire come devo fare a farlo funzionare?