Ver Mensaje Individual
  #8 (permalink)  
Antiguo 16/02/2007, 09:59
Avatar de freegirl
freegirl
Colaborador
 
Fecha de Ingreso: octubre-2003
Ubicación: Catalonia
Mensajes: 4.334
Antigüedad: 20 años, 7 meses
Puntos: 156
Re: como enviar un formulario a una dir. de correo electronico

También te puede servir:

VB 2005

Cita:
Imports System.net.Mail
Imports System.Environment

Public Function send(ByVal strFrom As String, ByVal strSubj As String, _
ByVal strBody As String, ByVal strSendTo As String, _
Optional ByVal Attachments As String = "") As Boolean
Try

Dim sMail As New MailMessage()

Dim address As New MailAddress(strFrom)
Dim sendTo As New MailAddress(strSendTo)
With sMail
.From = address
.To.Add(sendTo)
.Subject = strSubj
.Body = strBody

Dim strFile As String
Dim strAttach() As String = Split(Attachments, ";")
For Each strFile In strAttach
.Attachments.Add(New Attachment(Trim(strFile)))
Next

End With

Dim strUser As String = "Your_User_Name"
Dim strPassword As String = "Your_Password"
Dim strServer As String = "Your_SMTP_Server"

Dim smtp As SmtpClient = New SmtpClient(strServer)
If strUser <> String.Empty And strPassword <> String.Empty Then
smtp.Credentials = New Net.NetworkCredential(strUser, strPassword)
Else
smtp.UseDefaultCredentials = True
End If

smtp.Send(insMail)

sMail.Dispose()

Return True
Catch err As Exception
MessageBox.Show("Error Sending Mail:" & NewLine & err.Message)
Return False
End Try
End Function
fuente: VbForums