Dim email As String = "123@gmail.com"
Dim password As String = "******"
Dim server As New System.Net.Mail.SmtpClient
Dim mail As New System.Net.Mail.MailMessage
Dim attach As System.Net.Mail.Attachment = Nothing
Try
attach = New System.Net.Mail.Attachment(archivo)
mail.Attachments.Add(attach)
server.Credentials = New System.Net.NetworkCredential(email, password)
server.Port = "587"
server.Host = "smtp.gmail.com"
server.EnableSsl = True
mail.To.Add(email)
mail.From = New System.Net.Mail.MailAddress(email, xrutempresa, System.Text.Encoding.UTF8)
mail.Subject = xrutempresa & " Reporte " & Path.GetFileName(archivo)
server.Send(mail)
attach.Dispose()
Catch ex As Exception
attach.Dispose()
End Try
No hay comentarios.:
Publicar un comentario