ERROR: No se puede obtener acceso al objeto 'CDO.Message'.
el sub es el sigiente...espero q mpuedan ayudar....graicasssssss
Cita:
Sub btnEnviar(sender As Object, e1 As EventArgs)
Dim usuario as string = "rcaceres"
Dim smtp as string
Dim UsuaCorreo as string
Dim UsuaClave as string
Dim Port as Integer
' Dim ca As SqlConnection = _
' New SqlConnection("Data Source=(local); Initial Catalog=esglo; user id=sa; password=sa159")
' Dim command As SqlCommand = New SqlCommand( _
' "sp_sSeleccionCorreo " & usuario, _
' ca)
'
' ca.Open()
'
' Dim reader As SqlDataReader = command.ExecuteReader()
'
' if reader.HasRows = true then
' reader.read()
' smtp = reader.Item("smtp")
' UsuaCorreo = reader.Item("UsuaCorreo")
' UsuaClave = reader.Item("UsuaClave")
' Port = reader.Item("port")
smtp = "mail.esglo.com.pe"
UsuaCorreo = "rcaceres"
UsuaClave = "rcaceres"
Port = "25"
' end if
' lbl_usuario.Text = reader.Item("UsuaClave")
' ca.close()
Const ConfigNamespace As String = "http://schemas.microsoft.com/cdo/configuration/"
Dim oMsg As New System.Web.Mail.MailMessage
Dim Flds As System.Collections.IDictionary
Flds = oMsg.Fields
With Flds
.Add(ConfigNamespace & "smtpserver", smtp)
.Add(ConfigNamespace & "smtpserverport", Port)
.Add(ConfigNamespace & "sendusing", 2)
.Add(ConfigNamespace & "sendusername", UsuaCorreo)
.Add(ConfigNamespace & "sendpassword", UsuaClave)
.Add(ConfigNamespace & "smtpauthenticate", 1)
End With
With oMsg
.From = UsuaCorreo
.To = "[email protected]"
.Subject = "Test con MailMessage.Fields"
.Body = "Hola correo"
End With
Try
System.Web.Mail.SmtpMail.Send(oMsg)
labelerror.text = "Correo enviado ok"
Catch ex As Exception
LabelError.Text = "ERROR: " & ex.Message
End Try
End Sub
Dim usuario as string = "rcaceres"
Dim smtp as string
Dim UsuaCorreo as string
Dim UsuaClave as string
Dim Port as Integer
' Dim ca As SqlConnection = _
' New SqlConnection("Data Source=(local); Initial Catalog=esglo; user id=sa; password=sa159")
' Dim command As SqlCommand = New SqlCommand( _
' "sp_sSeleccionCorreo " & usuario, _
' ca)
'
' ca.Open()
'
' Dim reader As SqlDataReader = command.ExecuteReader()
'
' if reader.HasRows = true then
' reader.read()
' smtp = reader.Item("smtp")
' UsuaCorreo = reader.Item("UsuaCorreo")
' UsuaClave = reader.Item("UsuaClave")
' Port = reader.Item("port")
smtp = "mail.esglo.com.pe"
UsuaCorreo = "rcaceres"
UsuaClave = "rcaceres"
Port = "25"
' end if
' lbl_usuario.Text = reader.Item("UsuaClave")
' ca.close()
Const ConfigNamespace As String = "http://schemas.microsoft.com/cdo/configuration/"
Dim oMsg As New System.Web.Mail.MailMessage
Dim Flds As System.Collections.IDictionary
Flds = oMsg.Fields
With Flds
.Add(ConfigNamespace & "smtpserver", smtp)
.Add(ConfigNamespace & "smtpserverport", Port)
.Add(ConfigNamespace & "sendusing", 2)
.Add(ConfigNamespace & "sendusername", UsuaCorreo)
.Add(ConfigNamespace & "sendpassword", UsuaClave)
.Add(ConfigNamespace & "smtpauthenticate", 1)
End With
With oMsg
.From = UsuaCorreo
.To = "[email protected]"
.Subject = "Test con MailMessage.Fields"
.Body = "Hola correo"
End With
Try
System.Web.Mail.SmtpMail.Send(oMsg)
labelerror.text = "Correo enviado ok"
Catch ex As Exception
LabelError.Text = "ERROR: " & ex.Message
End Try
End Sub